{"id":13563744,"url":"https://github.com/beyondcode/laravel-self-diagnosis","last_synced_at":"2025-05-14T09:06:52.504Z","repository":{"id":32689626,"uuid":"139740733","full_name":"beyondcode/laravel-self-diagnosis","owner":"beyondcode","description":"Perform Self-Diagnosis Tests On Your Laravel Application","archived":false,"fork":false,"pushed_at":"2025-04-04T10:39:42.000Z","size":194,"stargazers_count":1441,"open_issues_count":11,"forks_count":111,"subscribers_count":24,"default_branch":"master","last_synced_at":"2025-05-14T09:06:05.760Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/beyondcode.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2018-07-04T15:43:10.000Z","updated_at":"2025-04-28T20:58:08.000Z","dependencies_parsed_at":"2024-06-18T11:00:47.824Z","dependency_job_id":"10265e77-e4f2-4e2a-8d36-520ad11d5cd8","html_url":"https://github.com/beyondcode/laravel-self-diagnosis","commit_stats":{"total_commits":98,"total_committers":30,"mean_commits":"3.2666666666666666","dds":0.7244897959183674,"last_synced_commit":"e6d36fea90f8d04bc8729f21a9ef7085c3d1b52a"},"previous_names":[],"tags_count":22,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beyondcode%2Flaravel-self-diagnosis","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beyondcode%2Flaravel-self-diagnosis/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beyondcode%2Flaravel-self-diagnosis/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beyondcode%2Flaravel-self-diagnosis/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/beyondcode","download_url":"https://codeload.github.com/beyondcode/laravel-self-diagnosis/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254110374,"owners_count":22016391,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T13:01:22.855Z","updated_at":"2025-05-14T09:06:52.481Z","avatar_url":"https://github.com/beyondcode.png","language":"PHP","funding_links":[],"categories":["PHP"],"sub_categories":[],"readme":"# Perform Self-Diagnosis Tests On Your Laravel Application\n\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/beyondcode/laravel-self-diagnosis.svg?style=flat-square)](https://packagist.org/packages/beyondcode/laravel-self-diagnosis)\n[![Total Downloads](https://img.shields.io/packagist/dt/beyondcode/laravel-self-diagnosis.svg?style=flat-square)](https://packagist.org/packages/beyondcode/laravel-self-diagnosis)\n\nThis package allows you to run self-diagnosis tests on your Laravel application. It comes with multiple checks out of the box and allows you to add custom checks yourself.\n\nHere is an example output of the command:\n\n![All Checks passed](https://beyondco.de/github/self-diagnosis/checks_green.png)\n\n## Included checks\n\n- Is the `APP_KEY` set?\n- Are your composer dependencies up to date with the `composer.lock` file?\n- Do you have the correct PHP version installed?\n- Do you have the correct PHP extensions installed?\n- Can a connection to the database be established?\n- Do the `storage` and `bootstrap/cache` directories have the correct permissions?\n- Does the `.env` file exist?\n- Is the maintenance mode disabled?\n- Are the required locales installed on the system?\n- Are there environment variables that exist in `.env.example` but not in `.env`?\n- Are there any migrations that need to be run?\n- Is the storage directory linked?\n- Can Redis be accessed?\n\n### Development environment checks\n\n- Is the configuration not cached?\n- Are the routes not cached?\n- Are there environment variables that exist in `.env` but not in `.env.example`?\n\n### Production environment checks\n\n- Is the configuration cached?\n- Are the routes cached?\n- Is the xdebug PHP extension disabled?\n- Is APP_DEBUG set to false?\n- Are certain servers reachable?\n- Are certain supervisor programs running?\n\n## Installation\n\nYou can install the package via composer:\n\n```bash\ncomposer require beyondcode/laravel-self-diagnosis\n```\n\n## Usage\n\nJust call the artisan command to start the checks:\n\n```bash\nphp artisan self-diagnosis\n```\n\n### Customization\n\nYou can publish the configuration file, that contains all available checks using:\n\n```bash\nphp artisan vendor:publish --provider=BeyondCode\\\\SelfDiagnosis\\\\SelfDiagnosisServiceProvider\n```\n\nThis will publish a `self-diagnosis.php` file in your `config` folder. This file contains all the checks that will be performed on your application.\n\n```php\n\u003c?php\n\nreturn [\n\n    /*\n     * A list of environment aliases mapped to the actual environment configuration.\n     */\n    'environment_aliases' =\u003e [\n        'prod' =\u003e 'production',\n        'live' =\u003e 'production',\n        'local' =\u003e 'development',\n    ],\n\n    /*\n     * Common checks that will be performed on all environments.\n     */\n    'checks' =\u003e [\n        \\BeyondCode\\SelfDiagnosis\\Checks\\AppKeyIsSet::class,\n        \\BeyondCode\\SelfDiagnosis\\Checks\\CorrectPhpVersionIsInstalled::class,\n        \\BeyondCode\\SelfDiagnosis\\Checks\\DatabaseCanBeAccessed::class =\u003e [\n            'default_connection' =\u003e true,\n            'connections' =\u003e [],\n        ],\n        \\BeyondCode\\SelfDiagnosis\\Checks\\DirectoriesHaveCorrectPermissions::class =\u003e [\n            'directories' =\u003e [\n                storage_path(),\n                base_path('bootstrap/cache'),\n            ],\n        ],\n        \\BeyondCode\\SelfDiagnosis\\Checks\\EnvFileExists::class,\n        \\BeyondCode\\SelfDiagnosis\\Checks\\ExampleEnvironmentVariablesAreSet::class,\n        \\BeyondCode\\SelfDiagnosis\\Checks\\LocalesAreInstalled::class =\u003e [\n            'required_locales' =\u003e [\n                'en_US',\n                'en_US.utf8',\n            ],\n        ],\n        \\BeyondCode\\SelfDiagnosis\\Checks\\MaintenanceModeNotEnabled::class,\n        \\BeyondCode\\SelfDiagnosis\\Checks\\MigrationsAreUpToDate::class,\n        \\BeyondCode\\SelfDiagnosis\\Checks\\PhpExtensionsAreInstalled::class =\u003e [\n            'extensions' =\u003e [\n                'openssl',\n                'PDO',\n                'mbstring',\n                'tokenizer',\n                'xml',\n                'ctype',\n                'json',\n            ],\n            'include_composer_extensions' =\u003e true,\n        ],\n        \\BeyondCode\\SelfDiagnosis\\Checks\\StorageDirectoryIsLinked::class,\n    ],\n\n    /*\n     * Environment specific checks that will only be performed for the corresponding environment.\n     */\n    'environment_checks' =\u003e [\n        'development' =\u003e [\n            \\BeyondCode\\SelfDiagnosis\\Checks\\ComposerWithDevDependenciesIsUpToDate::class =\u003e [\n                'additional_options' =\u003e '--ignore-platform-reqs',\n            ],\n            \\BeyondCode\\SelfDiagnosis\\Checks\\ConfigurationIsNotCached::class,\n            \\BeyondCode\\SelfDiagnosis\\Checks\\RoutesAreNotCached::class,\n        ],\n        'production' =\u003e [\n            \\BeyondCode\\SelfDiagnosis\\Checks\\ComposerWithoutDevDependenciesIsUpToDate::class =\u003e [\n                'additional_options' =\u003e '--ignore-platform-reqs',\n            ],\n            \\BeyondCode\\SelfDiagnosis\\Checks\\ConfigurationIsCached::class,\n            \\BeyondCode\\SelfDiagnosis\\Checks\\DebugModeIsNotEnabled::class,\n            \\BeyondCode\\SelfDiagnosis\\Checks\\PhpExtensionsAreDisabled::class =\u003e [\n                'extensions' =\u003e [\n                    'xdebug',\n                ],\n            ],\n            \\BeyondCode\\SelfDiagnosis\\Checks\\RedisCanBeAccessed::class =\u003e [\n                'default_connection' =\u003e true,\n                'connections' =\u003e [],\n            ],\n            \\BeyondCode\\SelfDiagnosis\\Checks\\RoutesAreCached::class,\n            \\BeyondCode\\SelfDiagnosis\\Checks\\ServersArePingable::class =\u003e [\n                'servers' =\u003e [\n                    'www.google.com',\n                    ['host' =\u003e 'www.google.com', 'port' =\u003e 8080],\n                    '8.8.8.8',\n                    ['host' =\u003e '8.8.8.8', 'port' =\u003e 8080, 'timeout' =\u003e 5],\n                ],\n            ],\n            \\BeyondCode\\SelfDiagnosis\\Checks\\SupervisorProgramsAreRunning::class =\u003e [\n                'programs' =\u003e [\n                    'horizon',\n                ],\n                'restarted_within' =\u003e 300, // max seconds since last restart, 0 to disable check\n            ],\n        ],\n    ],\n\n];\n```\n\n#### Available Configuration Options\n\nThe following options are available for the individual checks:\n\n- [`BeyondCode\\SelfDiagnosis\\Checks\\ComposerWithDevDependenciesIsUpToDate`](src/Checks/ComposerWithDevDependenciesIsUpToDate.php)\n  - **additional_options** *(string, optional parameters like `'--ignore-platform-reqs'`)*: optional arguments for composer\n- [`BeyondCode\\SelfDiagnosis\\Checks\\ComposerWithoutDevDependenciesIsUpToDate`](src/Checks/ComposerWithoutDevDependenciesIsUpToDate.php)\n  - **additional_options** *(string, optional parameters like `'--ignore-platform-reqs'`)*: optional arguments for composer\n- [`BeyondCode\\SelfDiagnosis\\Checks\\DatabaseCanBeAccessed`](src/Checks/DatabaseCanBeAccessed.php)\n  - **default_connection** *(boolean, default: `true`)*: if the default connection should be checked\n  - **connections** *(array, list of connection names like `['mysql', 'sqlsrv']`, default: `[]`)*: additional connections to check\n- [`BeyondCode\\SelfDiagnosis\\Checks\\DirectoriesHaveCorrectPermissions`](src/Checks/DirectoriesHaveCorrectPermissions.php)\n  - **directories** *(array, list of directory paths like `[storage_path(), base_path('bootstrap/cache')]`, default: `[]`)*: directories to check\n- [`BeyondCode\\SelfDiagnosis\\Checks\\LocalesAreInstalled`](src/Checks/LocalesAreInstalled.php)\n  - **required_locales** *(array, list of locales like `['en_US', 'en_US.utf8']`, default: `[]`)*: locales to check\n- [`BeyondCode\\SelfDiagnosis\\Checks\\PhpExtensionsAreDisabled`](src/Checks/PhpExtensionsAreDisabled.php)\n  - **extensions** *(array, list of extension names like `['xdebug', 'zlib']`, default: `[]`)*: extensions to check\n- [`BeyondCode\\SelfDiagnosis\\Checks\\PhpExtensionsAreInstalled`](src/Checks/PhpExtensionsAreInstalled.php)\n  - **extensions** *(array, list of extension names like `['openssl', 'PDO']`, default: `[]`)*: extensions to check\n  - **include_composer_extensions** *(boolean, default: `false`)*: if required extensions defined in `composer.json` should be checked\n- [`BeyondCode\\SelfDiagnosis\\Checks\\RedisCanBeAccessed`](src/Checks/RedisCanBeAccessed.php)\n  - **default_connection** *(boolean, default: `true`)*: if the default connection should be checked\n  - **connections** *(array, list of connection names like `['cache_1', 'cache_2']`, default: `[]`)*: additional connections to check\n- [`BeyondCode\\SelfDiagnosis\\Checks\\SupervisorProgramsAreRunning`](src/Checks/SupervisorProgramsAreRunning.php)\n  - **programs** *(array, list of programs like `['horizon', 'another-program']`, default: `[]`)*: programs that are required to be running\n  - **restarted_within** *(integer, max allowed seconds since last restart of programs (`0` = disabled), default: `0`)*: verifies that programs have been restarted recently to grab code updates\n- [`BeyondCode\\SelfDiagnosis\\Checks\\ServersArePingable`](src/Checks/ServersArePingable.php)\n  - **servers** *(array, list of servers and parameters like `['google.com', ['host' =\u003e 'google.com', 'port' =\u003e 8080]]`)*: servers to ping\n\n### Custom Checks\n\nYou can create custom checks, by implementing the [`BeyondCode\\SelfDiagnosis\\Checks\\Check`](src/Checks/Check.php) interface and adding the class to the config file.\nLike this:\n\n```php\n\u003c?php\n\nuse BeyondCode\\SelfDiagnosis\\Checks\\Check;\n\nclass MyCustomCheck implements Check\n{\n    /**\n     * The name of the check.\n     *\n     * @param array $config\n     * @return string\n     */\n    public function name(array $config): string\n    {\n        return 'My custom check.';\n    }\n\n    /**\n     * Perform the actual verification of this check.\n     *\n     * @param array $config\n     * @return bool\n     */\n    public function check(array $config): bool\n    {\n        return true;\n    }\n\n    /**\n     * The error message to display in case the check does not pass.\n     *\n     * @param array $config\n     * @return string\n     */\n    public function message(array $config): string\n    {\n        return 'This is the error message that users see if \"check\" returns false.';\n    }\n}\n```\n\n\n### Example Output\n\n\n![Some Checks failed](https://beyondco.de/github/self-diagnosis/checks_red.png)\n\n### Testing\n\n``` bash\ncomposer test\n```\n\n### Changelog\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.\n\n## Contributing\n\nPlease see [CONTRIBUTING](CONTRIBUTING.md) for details.\n\n### Security\n\nIf you discover any security related issues, please email marcel@beyondco.de instead of using the issue tracker.\n\n## Credits\n\n- [Marcel Pociot](https://github.com/mpociot)\n- [All Contributors](../../contributors)\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeyondcode%2Flaravel-self-diagnosis","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbeyondcode%2Flaravel-self-diagnosis","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeyondcode%2Flaravel-self-diagnosis/lists"}