updated docs

This commit is contained in:
Nick Yeoman 2022-11-17 20:25:09 -08:00
parent e54e634017
commit 4d3c87b01a
3 changed files with 48 additions and 6 deletions

View File

@ -10,3 +10,19 @@ rm nysymfony
cd YOUR_PROJECT_NAME
sudo docker-compose up -d
```
The next steps to take would be:
1. Verify the ```.env``` and ```docker-compose.md``` file
1. start docker
1. Create your controllers
1. Create your security
# Currently supported and tested on
I am only one man, I can only support the following, issues for other versions will be closed.
* PHP: 8.1
* Symfony: 6.1.7
* Docker: 20.10
* Mariadb: 10.7

View File

@ -131,7 +131,7 @@ echo "DBUSER=theuser${GEN}" >> .env
GEN=`echo $RANDOM | md5sum | head -c 12`
echo "DBPASSWORD=${GEN}" >> .env
echo '' >> .env
echo '# DATABASE_URL="mysql://app:!ChangeMe!@127.0.0.1:3306/app?serverVersion=8&charset=utf8mb4"'
echo '# DATABASE_URL="mysql://app:!ChangeMe!@127.0.0.1:3306/app?serverVersion=8&charset=utf8mb4"' >> .env
# TODO: move these here after you have symfony production ready
@ -143,6 +143,12 @@ wget https://raw.githubusercontent.com/nickyeoman/phpframework/main/docker/docke
echo "Creating a Dockerfile"
wget https://raw.githubusercontent.com/nickyeoman/phpframework/main/docker/Dockerfile
################################################################################
# Clean up
################################################################################
composer update
################################################################################
# Git
################################################################################
@ -156,7 +162,6 @@ git commit -m"New Project Script Run Completed"
php bin/console --version
echo "Symfony Installed"
echo "sudo docker-compose up -d"
echo "For more, go to: https://www.nickyeoman.com"
composer recipes
echo "Symfony Installed"

View File

@ -36,16 +36,37 @@ to the firewalls section of config/packages/security.yaml
### Modify the controller
```php
<?php
namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
class LoginController extends AbstractController
{
#[Route('/login', name: 'app_login')]
public function index(AuthenticationUtils $authenticationUtils): Response
{
$error = $authenticationUtils->getLastAuthenticationError();
$lastUsername = $authenticationUtils->getLastUsername();
return $this->render('login/index.html.twig', [
'last_username' => $lastUsername,
'error' => $error,
]);
}
}
```
### Modify the template
```php
{% extends '@nytwig/master.html.twig' %}
{% block title %}Hello LoginController!{% endblock %}
{% block content %}
{% if error %}
<div>{{ error.messageKey|trans(error.messageData, 'security') }}</div>