Show Menu

Composer,PSR standards Cheat Sheet (DRAFT) by

composer for install packages

This is a draft cheat sheet. It is a work in progress and is not finished yet.


Win install: https:­//g­etc­omp­ose­r.o­rg/­dow­nload/
Packages: https:­//p­ack­agi­
howto (czech): https:­//w­ww.i­tn­etw­­/ph­p/o­op/­com­poser/
composer --version //check version and if exists
composer init //generate compos­er.json file
composer install //download packages from compos­er.json
composer require phpmai­ler­/ph­pmailer //download phpmailer
composer update //update all packages
composer update phpmai­ler­/ph­pmailer //update phpmailer
require __DIR__ . '/vend­or/­aut­olo­ad.p­hp';
$mail=new PHPMai­ler­\PH­PMa­ile­r\P­HPM­ailer;


Symfony install:
composer create-project symfony/website-skeleton:"^5" hello-world
composer create-project symfony/skeleton:"6.1.*" my_project_directory

run server: 
php -S -t public

Apache setting:
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteRule ^$ public [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} !^public/
    RewriteRule ^(.*)$ public/$1

composer require symfony/apache-pack

show list of make function
php bin/console list make

Generator controller
php bin/console make:controller


PSR-0: Autolo­adi­ng(old)
PSR-1: coding standard basic
PSR-2: coding standard extend
PSR-3: logger interface
PSR-4: Autolo­adi­ng(new)
PSR-6: Caching Interface
PSR-7: interfaces for HTTP message interfaces
PSR-11: Dependenci Injections
PSR-13: Link
PSR-14: Event Dispatcher
PSR-15: Request Handlers
PSR-16: Common Interface for Caching Libraries
PSR-17: Factories
PSR-18: HTTP client

Docker //images

docker version //show if exist
docker build -t api_python .//built image container
docker run -d --name apicontainer -p 8080:8080 api_python:latest
docker -p //show all running containers
docker run apicontainer 
docker kill apicontainer
docker start apicontainer
docker pause apicontainer
docker unpause apicontainer
docker ps --all //show all containers
docker ps --filter status=paused

docker exec -it apicontainer sh // edit running container
docker restart apicontainer
docker rm apicontainer
docker image rm api_python


pwd //show actual path