PHP code example of artisanpack-ui / code-style-pint

1. Go to this page and download the library: Download artisanpack-ui/code-style-pint 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/ */

    

artisanpack-ui / code-style-pint example snippets



// pint-setup.php
StylePint\Config\PintConfigBuilder;

PintConfigBuilder::create()
    ->withArtisanPackUIPreset()
    ->save(__DIR__ . '/pint.json');

use ArtisanPackUI\CodeStylePint\Config\PintConfigBuilder;

// Full preset (use base_path() in Laravel apps, __DIR__ in packages)
PintConfigBuilder::create()
    ->withArtisanPackUIPreset()
    ->save(__DIR__ . '/pint.json');

// Customize rule groups
PintConfigBuilder::create()
    ->withFormattingRules(true)
    ->withCodeStructureRules(true)
    ->withBestPracticeRules(false)  // Disable strict types, yoda style, etc.
    ->withArtisanPackUIPreset()
    ->addRule('concat_space', ['spacing' => 'one'])
    ->removeRule('yoda_style')
    ->exclude('tests/fixtures')
    ->save(__DIR__ . '/pint.json');
bash
php artisan artisanpack:publish-pint-config
bash
php artisan artisanpack:publish-pint-config --force
bash
php artisan vendor:publish --tag=artisanpack-pint-config
bash
php pint-setup.php
bash
cp vendor/artisanpack-ui/code-style-pint/stubs/.php-cs-fixer.dist.php.stub .php-cs-fixer.dist.php
bash
php artisan artisanpack:publish-pint-config --wordpress
bash
# Install PHP-CS-Fixer
composer /php-cs-fixer fix
bash
./vendor/bin/php-cs-fixer fix
bash
./vendor/bin/php-cs-fixer fix --dry-run --diff