PHP code example of stanislas-poisson / php-dev-tools

1. Go to this page and download the library: Download stanislas-poisson/php-dev-tools library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

stanislas-poisson / php-dev-tools example snippets


use StanislasPoisson\DevTools\Rector;

return Rector::configure(__DIR__, php: '8.3')
    ->withSkip([SomeRector::class => [__DIR__ . '/src/Entity']]);

use StanislasPoisson\DevTools\Insights;

return Insights::config([
    'exclude' => ['config/reference.php'],
    'config'  => [
        SomeSniff::class => ['exclude' => ['src/Models']],
    ],
]);
sh
composer onfig allow-plugins.dealerdirect/phpcodesniffer-composer-installer true
vendor/bin/php-dev-tools init     # creates the files above, never replaces one
vendor/bin/php-dev-tools hooks    # activates the Git hooks
json
"scripts": {
    "analyse": "php-dev-tools analyse",
    "cs": "php-dev-tools cs",
    "cs:fix": "php-dev-tools cs:fix",
    "insights": "php-dev-tools insights",
    "markdown": "php-dev-tools markdown",
    "quality": ["php-dev-tools quality", "@test"],
    "quality:fast": "php-dev-tools quality:fast",
    "quality:fix": "php-dev-tools quality:fix",
    "rector": "php-dev-tools rector",
    "rector:fix": "php-dev-tools rector:fix",
    "test": "phpunit"
}
neon
 - vendor/stanislas-poisson/php-dev-tools/config/phpstan.neon

parameters:
    paths:
        - src
        - tests
sh
composer install
php bin/php-dev-tools hooks
composer quality   # the package passes its own tools