- Template
- User Entity created (with constraints and Unique Entity)
- plainPasswordField
- SecurityController with register, login and logout methods.
- Set up config/packages/security.yaml (encoder, provider and firewall).
- RegistrationFormType.
- login.html.twig and register.html.twig
- AgreeTerms and remember_me
- UserFixtures
- Condition "is_granted" in navbar.
- token and validation added in User Entity (see User Checkers)
Security DOC:
SF DOC Security
SFDOC LOGIN FORM
SF DOC form_login Authentication Provider
SF DOC remember me functionality
SF DOC CSRF protection
SF DOC registration form
SymfonyCasts Security
Users Checkers
- Advert Entity created (with constraints and Unique Entity)
- relation ManyToOne with User Entity (author field).
- AdvertController, AdvertFixtures, for loop in Twig to see all adverts.
- Twig view to see one advert.
- Pagination done.
- AddAdvertType form created.
- CRUD done with this entity.
DOC:
SF DOC Doctrine
SF DOC Relations
SF DOC Fixtures
SF DOC Validation
SymfonyCasts Pagination
- Application Entity created
- relation ManyToOne with User Entity (author field)
- relation ManyToOne with Advert Entity (advert field)
- ApplicationController, ApplicationType form.
- possibility to send an application to an advert.
- Category Entity created (with constraints and Unique Entity)
- relation ManyToMany with Advert Entity ( categories field).
- addAdvertType modified (EntityType, class Category, multiple)
- CategoryFixtures and categories can be seen in templates (index & view.html.twig)
- Add and Edit an advert with some categories works.
- We have now 4 entities :
- User related to Advert (OneToMany) and Application (OneToMany).
- Advert related to User (ManyToOne), Application (OneToMany) and Category (ManyToMany).
- Application related to User (ManyToOne) and Advert (ManyToOne).
- Category related to Advert (ManyToMany).
- Department Entity created
- relation OneToMany with Advert Entity (department field).
- DepartmentType form created.
- addAdvertType modified including DepartmentType so that we can see now where the advert is.
- DepartmentFixtures has been done with all french departments.
- Admin part has been enhanced:
- Admin can now change the User's role.
- Admin can now validate an advert.
- Admin can add or delete a category.
- Start Account Page
- Possibility to see my created adverts
- Possibility to see applications for those adverts.
- Add Flash messages.
- User can upload his curriculum vitae now.
- Roles have been defined: ROLE_RECRUITER and ROLE_CANDIDATE
- When registering, we must choose recruiter or candidate with a ChoiceType form.
- So in Twig, you don't see the same things wether you're a recruiter or not.
- UserFixtures changed consequently.
- A UploadFile Service has been done and used in AccountController.
- installed phpunit-bridge
- installed browser-kit
- installed css-selector
- vendor/bin/simple-phpunit (see Tests)
- vendor/bin/simple-phpunit --coverage-html {path} (see Tests in a browser)
- vendor/bin/simple-phpunit --testdox (pour voir ce qui est testé)
- vendor/bin/simple-phpunit --testdox-html {path}
- Natif à PHP5.6: phpdbg -qrr phpunit --coverage-html=.... (il faut XDEBUG: php --ri xdebug)
- Pour les tests, je désinstalle simple-phpunit et je passe par test-pack
- Puis bin/phpunit
- bin/phpunit --coverage-html var/phpunit
DOC:
SYMFONY DOC UPLOAD FILE
SYMFONY DOC HIERARCHICAL ROLES
- install PHPMetrics (vendor/bin/phpmetrics --report-html=doc/phpmetrics ./src )
- install PHPCodeSniffer (vendor/bin/phpcs et vendor/bin/phpcbf)
- install PHPMessDetector (vendor/bin/phpmd src/ html unusedcode --reportfile phpmd.html)
- install PHP Copy/Paste Detector (vendor/bin/phpcpd . )
- install Behat
- Badge Scrutinizer
- Badge CodeClimate
PHPMetrics
PHPCodeSniffer
PHPMessDetector
PHP Copy/Paste Detector
DOC PHPMD
Behat
- tests, quality, install
- Beware of indentation: cat -e -t -v makefile
- Travis CI (Voir fichier .travis.yml à la racine).
- Scrutinizer CI
- Circle CI (Voir .circleci/config.yml à la racine).
- Codeship CI (configuration online/Vérifier version PHP).
DOC SYMFONY && autres:
Testing
Customize Bootstrap Process before Running Tests
Tests
PHPUNIT
Simulate HTTP Authentication in a Functional Test
Test Code interacting with the database
Test Doctrine repositories
DOMCrawler Component
CssSelector Component
Voir également:
Jenkins
TeamCity
Gitlab CI
Buddy
API Platform
JWT TUTO JWT
OAuth TUTO OAuth
Postman
Richardson Model
Generate the SSH keys with JWT
$ mkdir -p config/jwt
$ openssl genrsa -out config/jwt/private.pem -aes256 4096
$ openssl rsa -pubout -in config/jwt/private.pem -out config/jwt/public.pemBe careful: you must put the key you chose in the .env file
Test Getting a token
curl -X POST -H "Content-Type: application/json" {yourdomain}/api/login_check -d '{"username":"{yourusername}", "password":"{yourpassword}"}'Authentification
curl -H "Authorization: Bearer {yourtoken}" {yourdomain}/apiDOC DOCKER
DOCKER HUB
Le docker Hub est un store où les utilisateurs de docker peuvent partager leurs images.
Installer une image: docker pull [image]
Gérer une image: docker image [command]
Lister les images téléchargées: docker image ls
Supprimer une image: docker image rm [nom ou ID image]
Vérifier les containers: docker container ls -a
Supprimer un container: docker container rm [container]
- -t : fournit un terminal au docker.
- -i : permet d'écrire dans le conteneur (couplé à -t)
- -d : exécute le conteneur en arrière-plan.
- -v : permet de monter u nrépertoire local sur le conteneur.
- -p : permet de binder un port sur le conteneur vers un port sur le host.
Le Dockerfile est un fichier qui contient toutes les instructions pour créer une image.
Liste des instructions:
FROM # Pour choisir l'image sur laquelle on se base, toujours en premier
RUN # Permet d'exécuter une commande
CMD # Commande exécutée au démarrage du conteneur par défaut
EXPOSE # Ouvre un port
ENV # Permet d'éditer des variables d'environnement
ARG # Un peu comme ENV, mais seulement le temps de la construction de l'image
COPY # Permet de copier un fichier ou répertoire de l'hôte vers l'image
ADD # Permet de copier un fichier de l'hôte ou depuis une URL vers l'image, permet également de décompresser une archive tar
LABEL # Des métadonnées utiles pour certains logiciels de gestion de conteneurs, comme rancher ou swarm, ou tout simplement pour mettre des informations sur l'image.
ENTRYPOINT # Commande exécutée au démarrage du conteneur, non modifiable, utilisée pour package une commande
VOLUME # Crée une partition spécifique
WORKDIR # Permet de choisir le répertoire de travail
USER # Choisit l'utilisateur qui lance la commande du ENTRYPOINT ou du CMD
ONBUILD # Crée un step qui sera exécuté seulement si notre image est choisie comme base
HEALTHCHECK # Permet d'ajouter une commande pour vérifier le fonctionnement de votre conteneur
STOPSIGNAL # permet de choisir le [signal](http://man7.org/linux/man-pages/man7/signal.7.html) qui sera envoyé au conteneur lorsque vous ferez un docker container stop
Construire l'image:
docker image build -t [imagename]:[tag] [dockerfile folder]
Exemple: docker image build -t philippe/apache .
Tester l'image:
docker container run -ti -p 80:80 philippe/apache
See this REPO
A ce stade, voici ce que j'ai:
docker build -t philippe .
Les étapes de construction du Dockerfile se déroulent.
docker ps -a
Cela permet de voir l'ID du container et l'image.
docker-compose up
docker-compose exec [nom_du_service] sh
A ce moment, si je fais un php -v, j'obtiens une 7.1 alors que je suis en 7.2
docker-compose ps vérifie que tout est lancé (le state doit être en Up)
Note: si je veux d'autres services type nginx, phpmyadmin, redis et autres, il faut les ajouter dans docker-compose.yaml.
Voir aussi ce REPO GITHUB très intéressant.
Blackfire
Les 5 principaux composants de Blackfire
Blackfire Doc
Voir fichier .blackfire.yml à la racine



