Symfony console

Updated: 19 November 2024

Generate a migration by comparing your current database to your mapping information

doctrine:migrations:diff

Create a new migration based on database changes

make:migration

List all configured routes in application

bin/console debug:router

Display environment variables used in the container

bin/console debug:container --env-vars

Symfony – scaffold app from existing database

Updated: 04 April 2024

Prepare for a new run

rm -r src/Entity/*
rm -r src/Form/*
rm -r src/Controller/*
rm -r src/Repository/*
rm -r templates/*

Copy in a backup of base twig template

cp base.html.twig templates/

Generate entities from an existing database

bin/console doctrine:mapping:import "App\Entity" annotation --path=src/Entity
bin/console make:entity --regenerate App

Make CRUD for each new entity

bin/console make:crud MyEntity
bin/console make:crud AnotherEntity
...

Adjust file permissions

sudo chown -R chris:chris templates/
sudo chown -R chris:chris src/Entity/
sudo chown -R chris:chris src/Controller/
sudo chown -R chris:chris src/Form/

Now, sql insert data fixtures

...

Composer

Updated: 09 November 2024

The require command adds new packages to the composer.json file. A composer.json file will be created if one doesn’t exist. After adding/changing the requirements, the modified requirements will be installed or updated.

Options:

  • --update-with-dependencies (-w): Also update dependencies of the newly required packages, except those that are root requirements.
  • --update-with-all-dependencies (-W): Also update dependencies of the newly required packages, including those that are root requirements.

Update a single package

composer update doctrine/doctrine-fixtures-bundle

Remove package(s)

php composer.phar remove vendor/package vendor/package2

List all packages and their versions

composer show

Install package at a particular version

composer require drupal/commerce_pricelist:2.0-rc2

The install command reads the composer.json file from the current directory, resolves the dependencies, and installs them into vendor.

composer install

Deletes all content from Composer’s cache directories.

composer clear-cache

Remove a package

composer remove vendor/package

PHPDoc

Updated: 06 May 2024

PHPDoc reference

Generate php documentation with phpdoc tool and Docker

docker pull phpdoc/phpdoc
cd path/to/my-php-project
docker run --rm -v $(pwd):/data phpdoc/phpdoc -d src -t doc

Display cli manual

docker run --rm phpdoc/phpdoc --help