kbunel/file-analyzer

Analyze a Symfony Application files

dev-master / 1.0.0.x-dev 2020-03-23 12:43 UTC

This package is not auto-updated.

Last update: 2024-10-30 09:11:02 UTC


README

FileAnalyzer is a tool to get information from files in your Symfony project

Installation

Step 1: Download the Bundle

Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:

$ composer require kbunel/file-analyzer --dev

This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation.

Step 2: Enable the Bundle

Then, enable the bundle by adding it to the list of registered bundles in the app/AppKernel.php file of your project:

<?php
// app/AppKernel.php

// ...
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        if (in_array($this->getEnvironment(), array('dev', 'test'))) {
            // ...
            new FileAnalyzer\FileAnalyzerBundle();
        );

        // ...
    }

    // ...
}

FileAnalyzer configuration

After running the command, there is many chances that some files haven't been identified.

To get the list of unidentified files, run: after running the command

php kbunel:app:analyze --kind=unknown_kind

This will output files that doesnt have been identified, you can specify add a new kind and get them from the path content, for example, if services from the folder src\AppBundle\Service has not been identified, you can add the configuration below and the FileAnalyzer will check the path to add it if it hasnt been found before. You can add as many as you want.

If your services are in a different folder than app/config/config.yml or app/config/config_test.yml, you can specify the path in services_file_path.

file_analyzer:
    file_analyzer:
        services_file_path: 'app/config/services.yaml'
    from_path:
        - { kind: 'service', in_path: 'Service' }
        - { kind: 'model', in_path: 'Model' }

Command

To analyze your files in your Symfony project, run:

$ php bin/console kbunel:app:analyze

Available options

Specify path to analyze:
$ php bin/console kbunel:app:analyze src/Controllers
Get path files with a specific kind:
$ php bin/console kbunel:app:analyze --kind=unknown_kind