updated docs
This commit is contained in:
parent
e54e634017
commit
4d3c87b01a
16
README.md
16
README.md
@ -10,3 +10,19 @@ rm nysymfony
|
|||||||
cd YOUR_PROJECT_NAME
|
cd YOUR_PROJECT_NAME
|
||||||
sudo docker-compose up -d
|
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
|
@ -131,7 +131,7 @@ echo "DBUSER=theuser${GEN}" >> .env
|
|||||||
GEN=`echo $RANDOM | md5sum | head -c 12`
|
GEN=`echo $RANDOM | md5sum | head -c 12`
|
||||||
echo "DBPASSWORD=${GEN}" >> .env
|
echo "DBPASSWORD=${GEN}" >> .env
|
||||||
echo '' >> .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
|
# 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"
|
echo "Creating a Dockerfile"
|
||||||
wget https://raw.githubusercontent.com/nickyeoman/phpframework/main/docker/Dockerfile
|
wget https://raw.githubusercontent.com/nickyeoman/phpframework/main/docker/Dockerfile
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
# Clean up
|
||||||
|
################################################################################
|
||||||
|
|
||||||
|
composer update
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Git
|
# Git
|
||||||
################################################################################
|
################################################################################
|
||||||
@ -156,7 +162,6 @@ git commit -m"New Project Script Run Completed"
|
|||||||
|
|
||||||
php bin/console --version
|
php bin/console --version
|
||||||
|
|
||||||
echo "Symfony Installed"
|
composer recipes
|
||||||
echo "sudo docker-compose up -d"
|
|
||||||
echo "For more, go to: https://www.nickyeoman.com"
|
|
||||||
|
|
||||||
|
echo "Symfony Installed"
|
@ -36,16 +36,37 @@ to the firewalls section of config/packages/security.yaml
|
|||||||
### Modify the controller
|
### Modify the controller
|
||||||
|
|
||||||
```php
|
```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();
|
$error = $authenticationUtils->getLastAuthenticationError();
|
||||||
$lastUsername = $authenticationUtils->getLastUsername();
|
$lastUsername = $authenticationUtils->getLastUsername();
|
||||||
|
|
||||||
return $this->render('login/index.html.twig', [
|
return $this->render('login/index.html.twig', [
|
||||||
'last_username' => $lastUsername,
|
'last_username' => $lastUsername,
|
||||||
'error' => $error,
|
'error' => $error,
|
||||||
]);
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
### Modify the template
|
### Modify the template
|
||||||
```php
|
```php
|
||||||
|
{% extends '@nytwig/master.html.twig' %}
|
||||||
|
|
||||||
|
{% block title %}Hello LoginController!{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
{% if error %}
|
{% if error %}
|
||||||
<div>{{ error.messageKey|trans(error.messageData, 'security') }}</div>
|
<div>{{ error.messageKey|trans(error.messageData, 'security') }}</div>
|
||||||
|
Reference in New Issue
Block a user