How to execute PHP code from the command line?

Simple just type

php -a

More info about php :


How to PHP Singleton with different schema Postgres Database connection PDO ?

 * Class StorageService
 * @package App\Core\Services
class StorageService extends \App\Core\Classes\Service

    private static $instance = null;
    private $storageConfigs = false;
    private $dbConnections = false;

    public $schema ;
    public $database_host ;
    public $database_port ;
    public $database_name ;
    public $database_user ;
    public $newConnection ;

    public function __construct($schema = 'api')

        $dbConfigs = $this->storageConfigs()['databases'];
        $dbConfig = $dbConfigs[$schema];

        $this->schema = $schema;
        $this->database_host = $dbConfig['database_host'];
        $this->database_port = $dbConfig['database_port'];
        $this->database_name = $dbConfig['database_name'];
        $this->database_user = $dbConfig['database_user'];
        $database_password  = $dbConfig['database_password'];

        $dsn = "pgsql:host={$this->database_host};port={$this->database_port};dbname={$this->database_name};";
        $pdoOpts =

        try {
            $this->newConnection = new \PDO($dsn, $this->database_user, $database_password, $pdoOpts);

        } catch (\Throwable $e) {

             * Add Exception error
             * @date July 15th 2021
             * @author David Raleche
            $error = 'MAPI CANT CONNECT DATABASE schema'.$schema
                .' DSN: '.$dsn
                .' USER: '.$this->database_user
                .' PASSWORD'.$database_password
                .' '.(string) $pdoOpts
                . '  ' .$e->getMessage();
            HelperService::logger('critical', $error);
            throw new \Exception('Database connection issue '.$e->getMessage(), 500);


     * Storage Configs
     * @return bool|mixed
    private function storageConfigs()
        if ($this->storageConfigs === false) {
            $this->storageConfigs = yaml_parse_file(__DIR__ . '/../../config/storage.yaml');
        return $this->storageConfigs;

     * Get Db connection
     * @param string $schema
     * @param bool $allowShared
     * @return bool|\PDO
    public function getConnection() : \PDO
        return $this->newConnection;

    public static function getInstance($schema)
        if(!self::$instance )
            self::$instance = new StorageService($schema);

        if ( self::$instance->schema !== $schema)
            self::$instance = new StorageService($schema);

        return self::$instance;
Continuous Integration/Development Programming


  • Is it going to fix something or make it more performant?
  • Can we afford it breaking what’s already working?
  • Does it require rewriting a lot of tests?
  • Do we really need to make that change?

From Mohamed Said – Laravel Team


How to Find php hacked files ?

grep -r --include=*.php -e '[[:alnum:]\/\+]\{137,\}'

How to clear cache in Symfony ?

rm -rf var/cache/*
Laravel Podcast

Laravel Podcast

RSS Error: A feed could not be found at ``; the status code is `404` and content-type is `text/html;charset=utf-8`
Books Interview

Book Review – Complete Software Developers Career Guide

Overall Grade : 3/5
Easy to read : 5/5

Take away : Very Good for starter in software development or novice in this area. This overview matches some of my professional experience.

The book contains about 800 pages and it quite covering a lot of elements

Missing Part [Politics]: Political IT environment – struggle – In an IT department, it is likely that the most efficient and logical decision will not be taken into account. Nowadays ITs/developers are run by marketers and political ambitious individuals. A full chapter should be dedicated on surviving such environment. Hard work is not rewarded anymore but eloquent techie speech makes the difference.

IT people are at fault somehow as they are easily dominated and replaced by consultants fabulous promises and speeches

Other missing Part Align business and IT: As professor Jerry Luftman mentionned many times IT and Business should be aligned

PHP PHPUnit Unix

Developer Helper – Command Cine

PSR-2 Code Styling

vendor/bin/phpcs --standard=PSR2  app src
vendor/bin/phpcbf --standard=PSR2  app src
vendor/bin/phpcbf --standard=PSR2 --report=json app src


vendor/bin/phpunit --log-junit web/phpunit/phpunit.xml --coverage-clover web/phpunit/coverage.xml --coverage-html web/phpunit/

Swagger Generate swagger documentation Swagger endpoint

vendor/bin/openapi -o "web/swagger.json" app/ src/ web/
Book Study Recommendation Books Symfony

BOOK : mastering symfony – Take away

Branding Web Design

20 of the Best Website Designs to Inspire You

Web design encompasses many different skills and disciplines in the production and maintenance of websites. The different areas of web design include web graphic design; interface design; authoring, including standardised code.