Toolkit of commands that should not be missed in you CI




Installs: 573 171

Dependents: 24

Suggesters: 0

Security: 0

Stars: 11

Watchers: 2

Forks: 1

11.1.4 2022-08-13 19:36 UTC

This package is auto-updated.

Last update: 2022-08-14 09:44:08 UTC


Downloads total

Tools that make easy to setup CI.

  • Check git conflicts in CI
  • Check TWIG and Latte templates for missing classes, non-existing static calls and constant fetches
  • Check YAML and NEON configs for the same
  • Extract Latte filters from static calls in templates


composer require symplify/easy-ci --dev


1. Check your Code for Git Merge Conflicts

Do you use Git? Then merge conflicts is not what you want in your code ever to see:

<<<<<<< HEAD
this is some content to mess with
content to append
totally different content to merge later

How to avoid it? Add check to your CI:

vendor/bin/easy-ci check-conflicts .

The /vendor directory is excluded by default.

2. Provide php-json for Dynamic GitHub Actions Matrix

Dynamic Matrix for GitHub Actions is one of cool way to simplify CI setup.

Instead of providing PHP versions manually one by one:

        # ...
                    - 7.3
                    - 7.4
                    - 8.0

Use information from your composer.json:

vendor/bin/easy-ci php-versions-json
# "[7.3, 7.4, 8.0]"

Use in GitHub Action Workflow like this:

        runs-on: ubuntu-latest

            # git clone + use PHP + composer install
            -   uses: actions/checkout@v2
            -   uses: shivammathur/setup-php@v2
                    php-version: 8.0

            -   uses: "ramsey/composer-install@v1"

            # to see the output
            -   run: vendor/bin/easy-ci php-versions-json

            # here we create the json, we need the "id:" so we can use it in "outputs" bellow
                id: output_data
                run: echo "::set-output name=matrix::$(vendor/bin/easy-ci php-versions-json)"

        # here, we save the result of this 1st phase to the "outputs"
            matrix: ${{ steps.output_data.outputs.matrix }}

        needs: provide_php_versions_json
            fail-fast: false
                php: ${{ fromJson(needs.provide_php_versions_json.outputs.matrix) }}

        # ...

3. Check Configs for Non-Existing Classes

vendor/bin/easy-ci check-config src

Supported types are YAML and NEON.

4. Check Templates for Non-Existing Classes

vendor/bin/easy-ci check-latte-template templates

5. Check Twig Controller Paths

vendor/bin/easy-ci check-twig-render src/Controller
final class SomeController
    public function index()
        return $this->render('does_path_exist.twig');

6. Avoid Static Calls in Latte Templates and use FilterProvider Instead

Static calls in Latte templates are a code smell. Make your code more decoupled and use a Latte filter instead:

 # any latte file

Filter provider can look like this:

use App\Contract\Latte\FilterProviderInterface;
use App\SomeClass;

final class SomeMethodFilterProvider implements FilterProviderInterface
    public function __invoke(string $name): int
        return SomeClass::someStaticMethod($name);

    public function getName(): string
        return 'someMethod';

7. Detect Static Calls in Your Code

vendor/bin/easy-ci detect-static src

8. Detect Commented Code

Have you ever forgot commented code in your code?

//      foreach ($matches as $match) {
//           $content = str_replace($match[0], $match[2], $content);
//      }

Clutter no more! Add check-commented-code command to your CI and don't worry about it:

vendor/bin/easy-ci check-commented-code <directory>
vendor/bin/easy-ci check-commented-code packages --line-limit 5

9. Short File === Class Name

Does short file name matches the class name?

vendor/bin/easy-ci check-file-class-name src

10. Avoid 2 classes in 1 File

What files have 2 and more classes?

vendor/bin/easy-ci find-multi-classes tests

Report Issues

In case you are experiencing a bug or want to request a new feature head over to the Symplify monorepo issue tracker


The sources of this package are contained in the Symplify monorepo. We welcome contributions for this package on symplify/symplify.