[
  {
    "path": ".editorconfig",
    "content": "; This file is for unifying the coding style for different editors and IDEs.\n; More information at http://editorconfig.org\n\nroot = true\n\n[*]\ncharset = utf-8\nindent_size = 4\nindent_style = space\nend_of_line = lf\ninsert_final_newline = true\ntrim_trailing_whitespace = true\n\n[*.md]\ntrim_trailing_whitespace = false\n"
  },
  {
    "path": ".gitattributes",
    "content": "# Path-based git attributes\n# https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html\n\n# Ignore all test and documentation with \"export-ignore\".\n/.gitattributes     export-ignore\n/.gitignore         export-ignore\n/.travis.yml        export-ignore\n/phpunit.xml.dist   export-ignore\n/.scrutinizer.yml   export-ignore\n/tests              export-ignore\n/.editorconfig      export-ignore\n"
  },
  {
    "path": ".github/workflows/php-code-quality.yml",
    "content": "name: Code Quality Workflow\non:\n  push:\n    branches:\n      - develop\n      - features/**\n      - feature/**\n      - upgrade/**\n  pull_request:\n      branches: [ develop ]\n\njobs:\n  laravel-tests:\n    strategy:\n        matrix:\n            operating-system: [ubuntu-latest]\n            php-versions: [ '8.4', '8.3', '8.2', '8.1' ]\n            dependency-stability: [ 'prefer-stable','prefer-lowest' ]\n\n    runs-on: ${{ matrix.operating-system }}\n\n\n    name: Test P${{ matrix.php-versions }} - L${{ matrix.laravel }} - ${{ matrix.dependency-stability }} - ${{ matrix.operating-system}}\n\n    steps:\n    - uses: actions/checkout@v4\n    - name: Install PHP versions\n      uses: shivammathur/setup-php@v2\n      with:\n        php-version: ${{ matrix.php-versions }}\n    - name: Install Dependencies\n      run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist\n\n    - name: Update Dependencies with latest stable\n      if: matrix.dependency-stability == 'prefer-stable'\n      run: composer update --prefer-stable\n    - name: Update Dependencies with lowest stable\n      if: matrix.dependency-stability == 'prefer-lowest'\n      run: composer update --prefer-stable --prefer-lowest\n\n# Code quality\n    - name: Execute tests (Unit and Feature tests) via PHPUnit\n      env:\n        SESSION_DRIVER: array\n      run: composer test\n\n\n  laravel-check:\n    strategy:\n        matrix:\n            operating-system: [ubuntu-latest]\n            php-versions: [ '8.3' ]\n\n    runs-on: ${{ matrix.operating-system }}\n\n\n    name: Check P${{ matrix.php-versions }} - ${{ matrix.operating-system}}\n\n    steps:\n    - uses: actions/checkout@v4\n    - name: Install PHP versions\n      uses: shivammathur/setup-php@v2\n      with:\n        php-version: ${{ matrix.php-versions }}\n    - name: Install Dependencies\n      run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist\n\n    - name: Execute Code Sniffer via phpcs\n      run: |\n        composer style-fix\n\n    - name: Execute Code Static Analysis (PHP Stan + Larastan)\n      run: |\n        composer phpstan\n"
  },
  {
    "path": ".github/workflows/php-lint.yml",
    "content": "name: PHP Syntax Checker (Lint)\n\non:\n  push:\n    branches: [ develop ]\n  pull_request:\n    branches: [ develop ]\n\njobs:\n  build:\n\n    runs-on: ubuntu-latest\n\n    steps:\n    - uses: actions/checkout@v4\n\n\n    - name: Validate composer.json and composer.lock\n      run: composer validate\n\n    - name: Install dependencies\n      run: composer install --prefer-dist --no-progress\n\n    - name: Run test suite\n      run: composer run-script test\n\n    - name: PHP Syntax Checker (Lint)\n      uses: StephaneBour/actions-php-lint@8.3\n      with:\n        dir: './src'\n"
  },
  {
    "path": ".gitignore",
    "content": "build\ndocs\ncomposer.lock\nvendor\ncoverage\n.phpunit.result.cache\n.phpunit.cache/\n.idea\n.php_cs.cache\n.vscode\n"
  },
  {
    "path": "CHANGELOG.md",
    "content": "# Changelog\n\n## 1.0.1 - 2024-11-29\n- Upgrade to PHP 8.4\n\n## 1.0.0 - 2024-03-13\n- upgrading packages\n\n## 0.5.2 - 2024-03-12\n- Updating hints for missing lang directory\n\n## 0.5.1 - 2024-03-07\n- Detect dependencies for Laravel 11\n\n## 0.5.0 - 2024-03-07\n- Support for Laravel 11\n\n## 0.4.1 - 2023-11-18\n- Testing with PHP 8.3\n- Adding title helper in the TermOutput\n- Adding RectorPHP in the code quality tools\n\n## 0.4.0 - 2023-02-04\n- Support for Laravel 10\n- Add requirements check for Laravel 10\n- GitHub Actions Workflows: cleaning and fine-tuning\n- Using Pint for Check styleguide (PSR12)\n- Using PestPHP for testing\n- Removing Makefile and using composer scripts to launching code quality tools\n- migrating tests from PHPUnit to PestPHP, thanks to @dansysanalyst\n- Fix skip-database option, now with works with all \"show\" options. Before the fix it worked only with \"show all\" option.\n\n## 0.3.1- 2022-07-17\n- Fine tuning dependencies for PHP 8.1, and Symfony / Doctrine packages\n- Drop supprt for PHP7.4, for older PHP and Laravel, use Laralens v0.2.x\n\n\n## 0.3.0 - 2022-07-17\n- Add Termwind package\n- Review console output, thanks also to @exodusanto\n- Support for PHP 8.0 and greater\n\n## 0.2.7 - 2022-01-23\n- Add Support for Laravel 9\n- Add tests for PHP8.1\n- Drop support for PHP7.3\n- Some fine tuning for Static Code analysis\n\n## 0.2.6 - 2021-10-03\nHacktoberfest!!!\nWe would like to say thank you to @tweichart and @martijnengler for the contributions.\n### Add\n- Add --all option for showing all information (verbose output). Thanks to @tweichart\n- Add --large option for using 120 chars width. Thanks to @martijnengler\n\n## 0.2.5 - 2021-06-18\n### Add\n- Add some Operating System information:\n    - PHP script owner's UID\n    - Current User\n    - Operating System\n    - Hostname\n    - Release name\n    - Machine Name\n    - Version info\n\n## 0.2.4 - 2021-04-18\n### Add\n- In runtime information, added upload_max_filesize and post_max_size from php configuration ( thanks to @yogendra-revanna )\n\n## 0.2.3 - 2021-04-10\n### Add\n- Check DEBUG and ENV configuration for production (if production avoid having debug on);\n- Check Storage Links and show the user a waring if some directory links are missing\n\n### Change\n- improve tests and checks script for Workflows\n\n## 0.2.2 - 2020-11-05\n### Add\n- Add configuration parameters (config/lara-lens.php) for managing webview: LARALENS_PREFIX, LARALENS_MIDDLEWARE, LARALENS_WEB_ENABLED, thanks to @yogendra-revanna, @JexPY, @Zuruckt;\n- Initial support for PHP8-rc;\n\n\n\n## 0.2.1 - 2020-09-22\n### Add\n- Show available PHP extension via --show=php-ext option  (thanks to https://github.com/yogendra-revanna);\n- Show PHP ini configuration via --show=php-ini (thanks to https://github.com/yogendra-revanna).\n\n### Change\n- Managing default show options. Before this change the default was to show all options. Now we have a lot of option to show (also the long list of PHP extension and PHP ini configuration), so by default LaraLens shows: configuration, runtime, HTTP connection, database, migrations.\n\n## 0.2.0 - 2020-09-20\n### Add\n- You can watch your LaraLens report with your browser (not just with your terminal);\n- Makefile to manage development tasks;\n- Add a _timeout_ when checking HTTP connection;\n- CI/CD: Add Caching vendors in GitHub actions pipeline.\n\n### Change\n- DOCS: Update README, add some docs about skip database connection and database.\n\n## 0.1.20 - 2020-09-11\n### Fix\nThanks to [phpstan](https://github.com/phpstan/phpstan) :\n- using $line instead of $row\n- initialize correctly $show\n- re throw exception for HTTP connection\n\n\n## 0.1.19 - 2020-09-11\n### Add\n- Add --skip-database in order to execute all checks except database and migration status (it is useful for example if the application it doesn't need the database);\n\n### Change\n- Code more PSR2 compliant (phpcs);\n- Fix LaraHttpResponse::status(). The method returns the http status code. Close #19\n\n\n## 0.1.18 - 2020-09-05\n### Add\n- Support for Laravel 8\n\n## 0.1.17 - 2020-08-30\n### Add\n- Adding support for Laravel 6\n- Check server requirements for  PHP modules needed by Laravel;\n- Check server requirements for PHP Version (based on the Laravel version);\n- Adding PORT display for Database connection;\n- List PHP modules installed, needed by Laravel;\n\n### Change\n- Updating test cases\n\n## 0.1.16 - 2020-08-19\n### Add\n- Adding php linter in CI/CD. We use php 7.2 linter for incoming support to Laravel 6.\n### Fix\n- Fix syntax in DatabaseLens.php. Close #17 ;\n\n## 0.1.15 - 2020-08-09\n\n### Add\n- Add --url-path for using a specific path during HTTP connection. For example --url-path=test (for checking \"test\" path)\n### Change\n- Refactor logic with traits for: database connection, configuration, runtime parameters, filesystem, http connections (issue #11);\n- Improve the HTTP Connection check (configuration url, url generated)\n\n\n## 0.1.14 - 2020-08-04\n\n- Refactoring \"check\" functionality\n- add warning messages\n- show report check\n- add alert green\n- managing multiple type of message (warning / error / hint)\n- try catch for db connection, for checking files, for scanning directories\n- check PDO for database connection\n\n\n## 0.1.13 - 2020-07-31\n\n### Add\n- Add hints for database tables (table exists, column exists)\n### Change\n- Fix typo in banner.  ( close #6 )\n- updated tests\n\n\n## 0.1.12 - 2020-07-25\n\n### Add\n- When a check is not working properly, now it is displayed some hints;\n- Add hints for database connection;\n- Add hints for HTTP connections.\n\n## 0.1.11 - 2020-07-12\n\n### Add\n\n### Change\n- Improved list of languages;\n- Update readme\n\n## 0.1.10 - 2020-06-25\n\n### Add\nNew function for check files.\n- check .env file\n- check language storage\n- list languages available\n\n## 0.1.9 - 2020-06-18\n\n### Add\n\nNew runtime config about some paths:\n\n* \"langPath\" =>\"Path to the language files\",\n* \"publicPath\" =>\" Path to the public / web directory\",\n* \"storagePath\" => \"Storage directory\",\n* \"resourcePath\" =>\"Resources directory\",\n* \"getCachedServicesPath\" => \"Path to the cached services.php\",\n* \"getCachedPackagesPath\" => \"Path to the cached packages.php\",\n* \"getCachedConfigPath\" => \"Path to the configuration cache\",\n* \"getCachedRoutesPath\" => \"Path to the routes cache\",\n* \"getCachedEventsPath\" => \"Path to the events cache file\",\n* \"getNamespace\" => \"Application namespace\"\n\n## 0.1.8 - 2020-06-18\n\n### Add\n\n:nail_care: Style output table via --style option. You can choose one of these styles (box-double is the default used by LaraLens):\n* default\n* borderless\n* compact\n* symfony-style-guide\n* box\n* box-double\n\n:eyeglasses: Runtime config:\n* environmentPath\n* environmentFile\n* environmentFilePath\n\n### Change\n\n* Refactor for App::\"function\"()\n* update tests\n* update readme\n* update help (-h)\n\n## 0.1.7 - 2020-06-16\n\n### Add\n\nDatabase connection:\n* connection name\n* getQueryGrammar\n* getDriverName\n* getDatabaseName\n* getTablePrefix\n* database server version\n\nRuntime configuration:\n* Laravel version\n* PHP version\n\n## 0.1.6 - 2020-06-01\n\n### Add\n\n* Add show option --show (all|config|runtime|connection|database|migration)\n\n## 0.1.5 - 2020-05-29\n\n### Improve\n\n* managing a better output\n* extracting long message from tables\n* settings width for columns tables\n\n\n## 0.1.4 - 2020-05-28\n\n### Fix\n\n* Catch HTTP connection exception\n\n## 0.1.3 - 2020-05-27\n\n### Add\n\n* detect DB connection type;\n* get tables for mysql;\n* get tables for sqlite;\n* count and retrieve last row from a table. Table and column name are as input parameters;\n* test database diagnostics;\n* update readme for documentation.\n\n\n## 0.1.2 - 2020-05-22\n\n### Add\n\n* Add new argument as input (it is optional):\n    - overview: you can see configuration, http connection, db connection etc.;\n    - allconfigs: you can see the verbose configuration from Laravel application. Try to use 'php artisan laralens:diagnostic allconfigs' in your laravel application. You will see the dump of all configuration parameters in json format.\n\n## 0.1.1 - 2020-05-22\n\n### Add\n\n* Add runtime config:\n    * App::getLocale()\n    * App::environment())\n    * Generated url via asset() and url() helpers\n* Invoke migrate:status\n\n## 0.1.0 - 2020-05-21\n\n* :tada: initial release\n* Add laralens:diagnostic artisan command (Laravel)\n* Check config parameter like app.url, app.locale, app.url and database.*\n* Check the http connection with \"app.url\" defined in base configuration\n* Check the connection with DB and counts the row for a specific table (users by default)\n"
  },
  {
    "path": "CONTRIBUTING.md",
    "content": "# Contributing\n\nContributions are **welcome** and will be fully **credited**.\n\nPlease read and understand the contribution guide before creating an issue or pull request.\n\n## Etiquette\n\nThis project is open source, and as such, the maintainers give their free time to build and maintain the source code\nheld within. They make the code freely available in the hope that it will be of use to other developers. It would be\nextremely unfair for them to suffer abuse or anger for their hard work.\n\nPlease be considerate towards maintainers when raising issues or presenting pull requests. Let's show the\nworld that developers are civilized and selfless people.\n\nIt's the duty of the maintainer to ensure that all submissions to the project are of sufficient\nquality to benefit the project. Many developers have different skillsets, strengths, and weaknesses. Respect the maintainer's decision, and do not be upset or abusive if your submission is not used.\n\n## Viability\n\nWhen requesting or submitting new features, first consider whether it might be useful to others. Open\nsource projects are used by many developers, who may have entirely different needs to your own. Think about\nwhether or not your feature is likely to be used by other users of the project.\n\n## Procedure\n\nBefore filing an issue:\n\n- Attempt to replicate the problem, to ensure that it wasn't a coincidental incident.\n- Check to make sure your feature suggestion isn't already present within the project.\n- Check the pull requests tab to ensure that the bug doesn't have a fix in progress.\n- Check the pull requests tab to ensure that the feature isn't already in progress.\n\nBefore submitting a pull request:\n\n- Check the codebase to ensure that your feature doesn't already exist.\n- Check the pull requests to ensure that another person hasn't already submitted the feature or fix.\n\n## Open a Pull Request\n\nIn order to maintain consistency in the source code we are following PSR12 coding standard, and using PHP stan for static code analysis.\nYou can use the command:\n```\nmake allcheck\n```\nto launch\n- **[PSR-12 Coding Standard](https://www.php-fig.org/psr/psr-12/)**, under the hood is used [PintPHP](https://laravel.com/docs/9.x/pint);\n- **PHPstan** with [level 5](https://phpstan.org/user-guide/rule-levels)\n- **PestPHP** to execute all tests from ./tests/*\n\nI suggest to launch *composer all* before to commit or before to create PR.\n\nIf you want to work on a PR, I suggest you to creating a new branch starting from **develop branch**, and use it also when you will submit your new **P**ull **R**equest on the original repository.\n\nIf you want to contribute with an high quality PR, I suggest you to focus not just on the source code but also:\n\n- **Add tests!** - Your patch won't be accepted if it doesn't have tests.\n\n- **Document any change in behaviour** - Make sure the `README.md` and any other relevant documentation are kept up-to-date.\n\n- **Consider our release cycle** - We try to follow [SemVer v2.0.0](https://semver.org/). Randomly breaking public APIs is not an option.\n\n- **One pull request per feature** - If you want to do more than one thing, send multiple pull requests.\n\n- **Send coherent history** - Make sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please [squash them](https://www.git-scm.com/book/en/v2/Git-Tools-Rewriting-History#Changing-Multiple-Commit-Messages) before submitting.\n\n**Happy coding**!\n"
  },
  {
    "path": "LICENSE.md",
    "content": "MIT License\n\nCopyright (c) Roberto Butti\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE."
  },
  {
    "path": "README.md",
    "content": "# LaraLens\n\n\n![CI/CD Github Actions](https://img.shields.io/github/actions/workflow/status/hi-folks/lara-lens/php-code-quality.yml?style=for-the-badge)\n![GitHub last commit](https://img.shields.io/github/last-commit/hi-folks/lara-lens?style=for-the-badge)\n![GitHub Release Date](https://img.shields.io/github/release-date/hi-folks/lara-lens?style=for-the-badge)\n![Packagist PHP Version](https://img.shields.io/packagist/v/hi-folks/lara-lens?style=for-the-badge)\n\n\n![LaraLens](https://raw.githubusercontent.com/Hi-Folks/lara-lens/develop/LaraLens-Laravel-Artisan.png)\n\n## What\n**LaraLens** is a _Laravel_ artisan command to show you the current configuration of your\napplication. It is useful to show in your terminal the status of:\n* some useful configuration variable;\n* the database connection;\n* the tables in the database;\n* the connection via HTTP request;\n* the server requirements (PHP version, PHP modules required and installed, Laravel version etc.).\n\n![LaraLens - diagnostic package for Laravel](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ryagpu0qqwgy476x5w5b.gif)\n\n\n## Why\nWhen I have a new Laravel Application deployed on the target server, usually I perform a list of commands in order to check the configuration, the connection to database, inspect some tables, the response of the web server.\nI tried to show more information in just one command.\nThis is useful also when the installation of your Laravel application is on premises, and someone else takes care about the configuration. So, in this scenario usually, as developer, your first question is: \"how is configured the application?\".\n\n## Installation\n\nYou can install the package via composer:\n\n```shell script\ncomposer require hi-folks/lara-lens\n```\n\nThe Packagist page is:\nhttps://packagist.org/packages/hi-folks/lara-lens\n\n## Usage\n\n```shell script\nphp artisan laralens:diagnostic\n```\n\n### Usage: control database connection\nYou can see Database Connection information, and you can choose the table to check, and the column used for the \"order by\" (default created_at):\n```shell script\nphp artisan laralens:diagnostic --table=migrations --column-sort=id\n```\nTo take the last **created** user:\n```shell script\nphp artisan laralens:diagnostic --table=users --column-sort=created_at\n```\nTo take the last **updated** user:\n```shell script\nphp artisan laralens:diagnostic --table=users --column-sort=updated_at\n```\n\n### Usage: control the output\nYou can control the output via the _show_ option. You can define:\n\n* config\n* connection\n* database\n* runtime\n* migration\n* php-ext\n* php-ini\n* all\n\nThe default for _--show_ option (if you avoid specifying _--show_) is to display: config, connection, database, runtime, migration.\n\n\n```shell script\nphp artisan laralens:diagnostic --show=config --show=connection --show=database --show=runtime --show=migration\n```\n\nIf you want to see only database information:\n\n```shell script\nphp artisan laralens:diagnostic --show=database\n```\n\nIf you want to see a verbose output (with also PHP extensions and PHP INI values):\n\n```shell script\nphp artisan laralens:diagnostic --show=all\n```\nor better:\n```shell script\nphp artisan laralens:diagnostic --all\n```\n\n\nIf you want to see only PHP extensions:\n```shell script\nphp artisan laralens:diagnostic --show=php-ext\n```\n\nIf you want to see only PHP INI values:\n```shell script\nphp artisan laralens:diagnostic --show=php-ini\n```\n\n### Usage: skip database connection and database diagnostics\nIf your Laravel application doesn't use the database, you can skip the database inspection with --skip-database option.\n\n```shell script\nphp artisan laralens:diagnostic --skip-database\n```\n\n### Usage: show some oprating system information\nYou can show some operating system information like:\n- PHP script owner's UID\n- Current User\n- Operating System\n- Hostname\n- Release name\n- Machine Name\n- Version info\n\nusing _\"--show os\"_ option or _\"--show all\"_ option\n```shell\nphp artisan laralens:diagnostic  --show os\n```\n\n### Usage: change the style of output table\nYou can choose one of these styles via *--style=* option:\n\n* default\n* borderless\n* compact\n* symfony-style-guide\n* box\n* box-double\n\nFor example:\n```sh\nphp artisan laralens:diagnostic --style=borderless\n```\n\n### Usage: change the width of the output table\nTo use 120 characters (wide terminal), you can use --large option\n```sh\nphp artisan laralens:diagnostic --large\n```\n\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## Usage as Web Page\n\nLaraLens provides information with the command line via terminal as shown above.\nYou have also the opportunity to see the information via your web browser.\nYou can enable web view via the configuration.\n\nPublish default configuration for LaraLens in your Laravel Application:\n```shell script\nphp artisan vendor:publish --provider=\"HiFolks\\LaraLens\\LaraLensServiceProvider\" --tag=\"config\"\n```\n\nAfter that,you will have a new configuration file in your config directory. The file is: config/lara-lens.php\n\nAdd `LARALENS_WEB_ENABLED=on` option to your .env file. You may also override the default parameters for `LARALENS_PREFIX` and `LARALENS_MIDDLEWARE`\n```\n# Wether Web Report should be enabled or not\nLARALENS_WEB_ENABLED=on\n# Path prefix in order to acess the Web Report via browser\nLARALENS_PREFIX=\"laralens\"\n# Which middleware should be used when acessing the Web Report, separete more with ;\nLARALENS_MIDDLEWARE=\"web;auth.basic\"\n```\n\nFor example, with the configuration above you would have enabled the web view (_web-enabled_ parameter) under _/laralens_test/_ path and with the `web` and `auth.basic` middleware\n\n```php\nreturn [\n    'prefix' => env('LARALENS_PREFIX', 'laralens'), // URL prefix (default=laralens)\n    'middleware' => explode(';', env('LARALENS_MIDDLEWARE', 'web')), // middleware (default=web) more separate with ;\n    'web-enabled' => env('LARALENS_WEB_ENABLED', 'off') // Activate web view (default=off)\n];\n```\n\n### Web view configuration hint\nLaraLens shows some internal configuration of your Laravel application, so I suggest you to disable it in a production environment.\nTo disable LaraLens web view, make sure to remove LARALENS_WEB_ENABLED config from .env file or set it to _off_\n```\nLARALENS_WEB_ENABLED=off\n```\n\n\n\n\n## Contributing\n\nPlease see [CONTRIBUTING](CONTRIBUTING.md) for details.\n\n### Submit ideas or feature requests or issues\n\n* Take a look if your request is already there [https://github.com/Hi-Folks/lara-lens/issues](https://github.com/Hi-Folks/lara-lens/issues)\n* If it is not present, you can create a new one [https://github.com/Hi-Folks/lara-lens/issues/new](https://github.com/Hi-Folks/lara-lens/issues/new)\n\n\n## Credits\n\n- [Roberto Butti](https://github.com/hi-folks)\n- [All Contributors](https://github.com/Hi-Folks/lara-lens/graphs/contributors)\n- [Laravel Package Boilerplate](https://laravelpackageboilerplate.com)\n\n## Who talks about LaraLens\n- [Laravel News](https://laravel-news.com/inspect-application-configuration-with-laralens)\n- [Medium Article](https://levelup.gitconnected.com/laralens-a-laravel-command-for-inspecting-configuration-2bbb4e714cf7)\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n"
  },
  {
    "path": "composer.json",
    "content": "{\n    \"name\": \"hi-folks/lara-lens\",\n    \"description\": \"Laravel Diagnostic command for configuration, db connection, http request\",\n    \"keywords\": [\n        \"laravel\",\n        \"diagnostic\",\n        \"cli\",\n        \"package\",\n        \"command-line\",\n        \"console\",\n        \"hi-folks\",\n        \"lara-lens\"\n    ],\n    \"homepage\": \"https://github.com/hi-folks/lara-lens\",\n    \"license\": \"MIT\",\n    \"type\": \"library\",\n    \"authors\": [\n        {\n            \"name\": \"Roberto Butti\",\n            \"role\": \"Developer\"\n        }\n    ],\n    \"require\": {\n        \"php\": \"^8.0|^8.1|^8.2|^8.3|^8.4\",\n        \"ext-json\": \"*\",\n        \"guzzlehttp/guzzle\": \"^7.8\",\n        \"nunomaduro/termwind\": \"^1.15|^2.0\"\n    },\n    \"require-dev\": {\n        \"doctrine/dbal\": \"^3.0|^4.0\",\n        \"larastan/larastan\": \"^2.0\",\n        \"laravel/pint\": \"^1.4\",\n        \"orchestra/testbench\": \"^7.0|^8.0|^9.0\",\n        \"pestphp/pest\": \"^2.34\",\n        \"pestphp/pest-plugin-laravel\": \"^1.2|^2.3\",\n        \"phpunit/phpunit\": \"^10.5\",\n        \"rector/rector\": \"^0.14|^1.0\"\n    },\n    \"autoload\": {\n        \"psr-4\": {\n            \"HiFolks\\\\LaraLens\\\\\": \"src\"\n        }\n    },\n    \"autoload-dev\": {\n        \"psr-4\": {\n            \"HiFolks\\\\LaraLens\\\\Tests\\\\\": \"tests\"\n        }\n    },\n    \"scripts\": {\n        \"all\": [\n            \"@style-fix\",\n            \"@phpstan\",\n            \"@test\"\n        ],\n        \"style-fix\": \"pint\",\n        \"style-check\": \"pint --test\",\n        \"phpstan\": \"phpstan analyse -c ./phpstan.neon --no-progress\",\n        \"test\": \"./vendor/bin/pest --order-by random\",\n        \"rector\": \"rector process --dry-run\"\n    },\n    \"scripts-descriptions\": {\n        \"test\": \"Run all tests, via PespPHP\",\n        \"style-fix\": \"Fix the code style with PSR12\",\n        \"style-check\": \"Check the code style with PSR12\",\n        \"phpstan\": \"Run static code analysis via PHPStan\",\n        \"rector\": \"Suggest refactoring to be more PHP 8 compliant\",\n        \"all\": \"Execute tasks for fixing code style, static code analysis and tests\"\n    },\n    \"config\": {\n        \"sort-packages\": true,\n        \"allow-plugins\": {\n            \"composer/package-versions-deprecated\": false,\n            \"pestphp/pest-plugin\": true\n        }\n    },\n    \"extra\": {\n        \"laravel\": {\n            \"providers\": [\n                \"HiFolks\\\\LaraLens\\\\LaraLensServiceProvider\"\n            ],\n            \"aliases\": {\n                \"LaraLens\": \"HiFolks\\\\LaraLens\\\\LaraLensFacade\"\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "config/config.php",
    "content": "<?php\n\n/*\n * LaraLens Configuration.\n */\nreturn [\n    'prefix' => env('LARALENS_PREFIX', 'laralens'), // URL prefix (default=laralens)\n    'middleware' => explode(';', env('LARALENS_MIDDLEWARE', 'web')), // middleware (default=web) more separate with ;\n    'web-enabled' => env('LARALENS_WEB_ENABLED', 'off') // Activate web view (default=off)\n];\n"
  },
  {
    "path": "phpcs.xml",
    "content": "<?xml version=\"1.0\"?>\n<ruleset  name=\"PHP_CodeSniffer\">\n    <description>PHPCS configuration file.</description>\n    <file>src</file>\n    <exclude-pattern>*/exclude/*</exclude-pattern>\n    <!-- ignore warnings and display ERRORS only -->\n    <arg  value=\"np\"/>\n    <rule  ref=\"PSR12\"/>\n</ruleset>\n"
  },
  {
    "path": "phpstan.neon",
    "content": "includes:\n    - ./vendor/larastan/larastan/extension.neon\nparameters:\n    reportUnmatchedIgnoredErrors: false\n    ignoreErrors:\n        - '#Parameter .1 \\$separator of function explode expects non-empty-string, string given.#'\n\n    level: 5\n    paths:\n        - src\n"
  },
  {
    "path": "phpunit.xml.dist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<phpunit xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" bootstrap=\"vendor/autoload.php\" backupGlobals=\"false\" colors=\"true\" processIsolation=\"false\" stopOnFailure=\"false\" xsi:noNamespaceSchemaLocation=\"https://schema.phpunit.de/10.5/phpunit.xsd\" cacheDirectory=\".phpunit.cache\" backupStaticProperties=\"false\">\n  <coverage>\n    <report>\n      <clover outputFile=\"build/logs/clover.xml\"/>\n      <html outputDirectory=\"build/coverage\"/>\n      <text outputFile=\"build/coverage.txt\"/>\n    </report>\n  </coverage>\n  <testsuites>\n    <testsuite name=\"Test Suite\">\n      <directory>tests</directory>\n    </testsuite>\n  </testsuites>\n  <logging>\n    <junit outputFile=\"build/report.junit.xml\"/>\n  </logging>\n  <php>\n    <env name=\"DB_CONNECTION\" value=\"testing\"/>\n  </php>\n  <source>\n    <include>\n      <directory suffix=\".php\">src/</directory>\n    </include>\n  </source>\n</phpunit>\n"
  },
  {
    "path": "phpunit.xml.dist.bak",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<phpunit xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" bootstrap=\"vendor/autoload.php\" backupGlobals=\"false\" backupStaticAttributes=\"false\" colors=\"true\" verbose=\"true\" convertErrorsToExceptions=\"true\" convertNoticesToExceptions=\"true\" convertWarningsToExceptions=\"true\" processIsolation=\"false\" stopOnFailure=\"false\" xsi:noNamespaceSchemaLocation=\"https://schema.phpunit.de/9.3/phpunit.xsd\">\n  <coverage>\n    <include>\n      <directory suffix=\".php\">src/</directory>\n    </include>\n    <report>\n      <clover outputFile=\"build/logs/clover.xml\"/>\n      <html outputDirectory=\"build/coverage\"/>\n      <text outputFile=\"build/coverage.txt\"/>\n    </report>\n  </coverage>\n  <testsuites>\n    <testsuite name=\"Test Suite\">\n      <directory>tests</directory>\n    </testsuite>\n  </testsuites>\n  <logging>\n    <junit outputFile=\"build/report.junit.xml\"/>\n  </logging>\n  <php>\n    <env name=\"DB_CONNECTION\" value=\"testing\"/>\n  </php>\n</phpunit>\n"
  },
  {
    "path": "pint.json",
    "content": "{\n    \"preset\": \"psr12\"\n}\n"
  },
  {
    "path": "psalm.xml",
    "content": "<?xml version=\"1.0\"?>\n<psalm\n    errorLevel=\"4\"\n    resolveFromConfigFile=\"true\"\n    xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n    xmlns=\"https://getpsalm.org/schema/config\"\n    xsi:schemaLocation=\"https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd\"\n>\n    <projectFiles>\n        <directory name=\"src\"/>\n        <ignoreFiles>\n            <directory name=\"vendor\"/>\n        </ignoreFiles>\n    </projectFiles>\n<plugins><pluginClass class=\"Psalm\\LaravelPlugin\\Plugin\"/></plugins></psalm>\n"
  },
  {
    "path": "rector.php",
    "content": "<?php\n\ndeclare(strict_types=1);\n\nuse Rector\\CodeQuality\\Rector\\Class_\\InlineConstructorDefaultToPropertyRector;\nuse Rector\\Config\\RectorConfig;\nuse Rector\\Set\\ValueObject\\LevelSetList;\n\nreturn static function (RectorConfig $rectorConfig): void {\n    $rectorConfig->paths([\n        __DIR__ . '/src'\n    ]);\n\n    // register a single rule\n    // $rectorConfig->rule(InlineConstructorDefaultToPropertyRector::class);\n\n    // define sets of rules\n    $rectorConfig->sets([\n        LevelSetList::UP_TO_PHP_80\n    ]);\n};\n"
  },
  {
    "path": "resources/views/laralens/index.blade.php",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n    <meta charset=\"utf-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n    <meta name=\"theme-color\" content=\"#000000\" />\n    <link href=\"https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css\" rel=\"stylesheet\">\n    <title>LaraLens</title>\n</head>\n<body>\n\n\n<nav class=\"relative flex flex-wrap items-center justify-between px-2 py-3 navbar-expand-lg bg-yellow-500 mb-3\">\n    <div class=\"container px-4 mx-auto flex flex-wrap items-center justify-between\">\n        <div class=\"w-full relative flex justify-between lg:w-auto  px-4 lg:static lg:block lg:justify-start  font-bold leading-relaxed inline-block mr-4 py-2 whitespace-no-wrap text-white\">\n\n            LaraLens\n\n        </div>\n        <div class=\"lg:flex flex-grow items-center\" id=\"example-navbar-warning\">\n            <ul class=\"flex flex-col lg:flex-row list-none ml-auto\">\n                <li class=\"nav-item\">\n                    <a class=\"px-3 py-2 flex items-center text-xs uppercase font-bold leading-snug text-white hover:opacity-75\" href=\"https://medium.com/@robertodev/laralens-a-laravel-command-for-inspecting-configuration-2bbb4e714cf7\">\n                        Tutorial\n                    </a>\n                </li>\n                <li class=\"nav-item\">\n                    <a class=\"px-3 py-2 flex items-center text-xs uppercase font-bold leading-snug text-white hover:opacity-75\" href=\"https://packagist.org/packages/hi-folks/lara-lens\">\n                        Packagist\n                    </a>\n                </li>\n                <li class=\"nav-item\">\n                    <a class=\"px-3 py-2 flex items-center text-xs uppercase font-bold leading-snug text-white hover:opacity-75\" href=\"https://github.com/Hi-Folks/lara-lens\">\n                        GitHub\n                    </a>\n                </li>\n            </ul>\n        </div>\n    </div>\n</nav>\n\n@foreach( $data as $item)\n<div class=\"bg-white shadow overflow-hidden sm:rounded-lg\">\n    <div class=\"px-4 py-5 border-b border-gray-200 sm:px-6\">\n        <h3 class=\"text-lg leading-6 font-medium text-gray-900\">\n            {{$item['title']}}\n        </h3>\n        <p class=\"mt-1 max-w-2xl text-sm leading-5 text-gray-500\">\n            {{$item['description']}}\n        </p>\n    </div>\n    <div>\n        <dl class=\"divide-y divide-gray-400\">\n            @foreach( $item['data'] as $line)\n            <div class=\"{{ $loop->even ? \"bg-gray-200\" : \"bg-white\" }} px-4 py-1 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6\">\n                <dt class=\"text-sm leading-5 font-medium text-gray-700\">\n                    {{ $line['label'] }}\n                </dt>\n                <dd class=\"mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2\">\n                    {{ $line['value'] }}\n\n                </dd>\n            </div>\n            @endforeach\n        </dl>\n    </div>\n</div>\n@endforeach\n\n@foreach( $checks as $item)\n    @if(\\Illuminate\\Support\\Arr::get($item, \"lineType\", \\HiFolks\\LaraLens\\ResultLens::LINE_TYPE_DEFAULT) === \\HiFolks\\LaraLens\\ResultLens::LINE_TYPE_HINT)\n        <div class=\"bg-blue-100 border-l-4 border-blue-500 text-blue-700 p-4\" role=\"alert\">\n            <p class=\"font-bold\">{{ $item['label'] }}</p>\n            <p>{{ $item['value']  }}</p>\n        </div>\n\n    @elseif(\\Illuminate\\Support\\Arr::get($item, \"lineType\", \\HiFolks\\LaraLens\\ResultLens::LINE_TYPE_DEFAULT) === \\HiFolks\\LaraLens\\ResultLens::LINE_TYPE_ERROR)\n        <div class=\"bg-red-100 border-l-4 border-red-500 text-red-700 p-4\" role=\"alert\">\n            <p class=\"font-bold\">{{ $item['label'] }}</p>\n            <p>{{ $item['value']  }}</p>\n        </div>\n    @elseif(\\Illuminate\\Support\\Arr::get($item, \"lineType\", \\HiFolks\\LaraLens\\ResultLens::LINE_TYPE_DEFAULT) === \\HiFolks\\LaraLens\\ResultLens::LINE_TYPE_WARNING)\n        <div class=\"bg-orange-100 border-l-4 border-orange-500 text-orange-700 p-4\" role=\"alert\">\n            <p class=\"font-bold\">{{ $item['label'] }}</p>\n            <p>{{ $item['value']  }}</p>\n        </div>\n    @else\n        <div class=\"bg-grey-100 border-l-4 border-grey-500 text-grey-700 p-4\" role=\"alert\">\n            <p class=\"font-bold\">{{ $item['label'] }}</p>\n            <p>{{ $item['value']  }}</p>\n        </div>\n\n    @endif\n\n@endforeach\n\n</body>\n</html>\n"
  },
  {
    "path": "resources/views/laralens/term/checks.blade.php",
    "content": "<div class=\"mt-2 mx-1\">\n    @if (sizeof($rows) > 0)\n        <div class=\"flex space-x-1\">\n            <span class=\"text-red\">CHECK: issues found</span>\n            <span class=\"flex-1 content-repeat-[─] text-red\"></span>\n        </div>\n    @else\n        <div class=\"flex space-x-1\">\n            <span class=\"text-green\">CHECK: everything looks good</span>\n            <span class=\"flex-1 content-repeat-[─] text-green\"></span>\n        </div>\n    @endif\n    <div>\n        @foreach ($rows as $row)\n            @php\n                $lineType = Arr::get($row, \"lineType\", HiFolks\\LaraLens\\ResultLens::LINE_TYPE_DEFAULT);\n                $label = Arr::get($row, \"label\", \"\");\n            @endphp\n            @if ($label === \"*** HINT\")\n                <div class=\"flex space-x-1 mt-1\">\n                    <span class=\"px-1 text-gray-100\">💡 Hint:</span>\n                    <span>\n                        <span class=\"px-0  text-gray-300\">\n                            {{ Arr::get($row, \"value\", \"\") }}\n                        </span>\n                    </span>\n                </div>\n            @else\n                <div @class([\n                        'w-full mx-1 py-1 mt-1 text-center font-bold',\n                        'bg-red text-white' => $lineType === HiFolks\\LaraLens\\ResultLens::LINE_TYPE_ERROR,\n                        'bg-yellow text-black' => $lineType === HiFolks\\LaraLens\\ResultLens::LINE_TYPE_WARNING,\n                        'bg-green text-white' => $lineType !== HiFolks\\LaraLens\\ResultLens::LINE_TYPE_ERROR\n                            && $lineType !== HiFolks\\LaraLens\\ResultLens::LINE_TYPE_WARNING,\n                ])>\n                    {{ Arr::get($row, \"label\", \"\")}}\n                </div>\n                <div class=\"mt-1 mx-1 text-gray-300\">\n                    @if ($lineType === HiFolks\\LaraLens\\ResultLens::LINE_TYPE_ERROR)\n                        {{ Arr::get($row, \"value\", \"\")}}\n                    @elseif ($lineType === HiFolks\\LaraLens\\ResultLens::LINE_TYPE_WARNING)\n                        {{ Arr::get($row, \"value\", \"\")}}\n                    @else\n                        {{ Str::replace(\"\\\\\", \"/\", Arr::get($row, \"value\", \"\")) }}\n                    @endif\n                </div>\n            @endif\n        @endforeach\n    </div>\n</div>\n"
  },
  {
    "path": "resources/views/laralens/term/table.blade.php",
    "content": "<div class=\"mt-1.5 mx-1\">\n    <div class=\"flex space-x-1\">\n        <span class=\"text-green\">{{ $title }}</span>\n        <span class=\"flex-1 content-repeat-[─] text-gray\"></span>\n    </div>\n    <div class=\"mt-1\">\n        <span>\n            @foreach ($rows as $row)\n                @php\n                    $lineType = Arr::get($row, \"lineType\", HiFolks\\LaraLens\\ResultLens::LINE_TYPE_DEFAULT);\n                    $label = Arr::get($row, \"label\", \"\");\n                @endphp\n                @if ($label === \"*** HINT\")\n                    <div class=\"flex space-x-1\">\n                    <span class=\" text-white  font-bold\">Hint:</span>\n                    <span class=\"flex-1  content-repeat-[.] text-gray\"></span>\n                    <div>\n                        <span class=\"px-2 text-gray font-bold\">\n                            {{ Arr::get($row, \"value\", \"\") }}\n                        </span>\n                    </div>\n                </div>\n                @else\n                    <div class=\"flex space-x-1\">\n                    <span class=\" text-white  font-bold\">\n                        {{ Arr::get($row, \"label\", \"\")}}\n                    </span>\n\n                    <span class=\"flex-1  content-repeat-[.] text-gray\"></span>\n\n                    <span>\n                        @if ($lineType === HiFolks\\LaraLens\\ResultLens::LINE_TYPE_ERROR)\n                            <span class=\"text-gray-100 bg-red  font-bold\">\n                                {{ Arr::get($row, \"value\", \"\")}}\n                            </span>\n                        @elseif ($lineType === HiFolks\\LaraLens\\ResultLens::LINE_TYPE_WARNING)\n                            <span class=\"text-gray-100 bg-yellow  font-bold\">\n                                {{ Arr::get($row, \"value\", \"\")}}\n                            </span>\n                        @else\n                            <span class=\"text-gray-100\">\n                                {{ Str::replace(\"\\\\\", \"/\", Arr::get($row, \"value\", \"\")) }}\n                            </span>\n                        @endif\n                    </span>\n                </div>\n                @endif\n            @endforeach\n        </span>\n    </div>\n\n</div>\n"
  },
  {
    "path": "routes/web.php",
    "content": "<?php\n\nuse Illuminate\\Support\\Facades\\Route;\nuse HiFolks\\LaraLens\\Http\\Controllers\\LaraLensController;\n\nRoute::get('/', [LaraLensController::class, 'index'])->name('laralens.index');\n"
  },
  {
    "path": "src/Console/LaraLensCommand.php",
    "content": "<?php\n\nnamespace HiFolks\\LaraLens\\Console;\n\nuse HiFolks\\LaraLens\\Lens\\LaraLens;\nuse HiFolks\\LaraLens\\Lens\\Traits\\TermOutput;\nuse HiFolks\\LaraLens\\ResultLens;\nuse Illuminate\\Console\\Command;\n\nclass LaraLensCommand extends Command\n{\n    use TermOutput;\n\n    private const TABLE_STYLES = 'default|borderless|compact|symfony-style-guide|box|box-double';\n    private const DEFAULT_STYLE = 'box-double';\n    private const DEFAULT_PATH = '';\n    protected $styleTable = self::DEFAULT_STYLE;\n    protected $signature = 'laralens:diagnostic\n                            {op=overview : What you want to see, overview or allconfigs (overview|allconfigs)}\n                            {--table=users : name of the table, default users}\n                            {--column-sort=created_at : column name used for sorting}\n                            {--url-path=' . self::DEFAULT_PATH . ' : default path for checking URL}\n                            {--show=* : show (all|config|runtime|connection|database|migration|php-ext|php-ini|os)}\n                            {--width-label=' . self::DEFAULT_WIDTH . ' : width of column for label}\n                            {--width-value=' . self::DEFAULT_WIDTH . ' : width of column for value}\n                            {--large : use 120 columns for the output}\n                            {--style=' . self::DEFAULT_STYLE . ' : style for output table (' . self::TABLE_STYLES . ')}\n                            {--skip-database : skip database check (if your laravel app doesn\\'t need Database)}\n                            {--a|all : verbose output (--show=all)}\n                            ';\n\n    protected $description = 'Show some application configurations.';\n\n    private const DEFAULT_WIDTH = 36;\n    private const DEFAULT_LARGE_WIDTH = 77;\n    protected $widthLabel = self::DEFAULT_WIDTH;\n    protected $widthValue = self::DEFAULT_WIDTH;\n\n    protected $urlPath = self::DEFAULT_PATH;\n\n    public const OPTION_SHOW_NONE = 0b0000000;\n    public const OPTION_SHOW_CONFIGS = 0b0000001;\n    public const OPTION_SHOW_RUNTIMECONFIGS = 0b00000010;\n    public const OPTION_SHOW_CONNECTIONS = 0b00000100;\n    public const OPTION_SHOW_DATABASE = 0b00001000;\n    public const OPTION_SHOW_MIGRATION = 0b00010000;\n    public const OPTION_SHOW_PHPEXTENSIONS = 0b00100000;\n    public const OPTION_SHOW_PHPINIVALUES = 0b01000000;\n    public const OPTION_SHOW_OS = 0b10000000;\n    public const OPTION_SHOW_ALL = 0b11111111;\n    public const OPTION_SHOW_DEFAULT = 0b00011111;\n\n    private function allConfigs(): void\n    {\n        $this->info(json_encode(config()->all(), JSON_PRETTY_PRINT));\n    }\n\n    private function overview($checkTable = \"users\", $columnSorting = \"created_at\", $show = self::OPTION_SHOW_ALL): void\n    {\n        $ll = new LaraLens();\n        if ($show & self::OPTION_SHOW_CONFIGS) {\n            $output = $ll->getConfigs();\n            $this->printOutputTerm(\"Config keys via config()\", $output->toArray());\n        }\n        if ($show & self::OPTION_SHOW_RUNTIMECONFIGS) {\n            $output = $ll->getRuntimeConfigs();\n            $this->printOutputTerm(\"Runtime Configs\", $output->toArray());\n            $output = $ll->checkServerRequirements();\n            $this->printOutputTerm(\"Laravel Requirements\", $output->toArray());\n        }\n        if ($show & self::OPTION_SHOW_RUNTIMECONFIGS) {\n            $output = $ll->checkFiles();\n            $this->printOutputTerm(\"Check files\", $output->toArray());\n        }\n        if ($show & self::OPTION_SHOW_CONNECTIONS) {\n            $output = $ll->getConnections($this->urlPath);\n            $this->printOutputTerm(\"Connections\", $output->toArray());\n        }\n        if ($show & self::OPTION_SHOW_DATABASE) {\n            $output = $ll->getDatabase($checkTable, $columnSorting);\n            $this->printOutputTerm(\"Database\", $output->toArray());\n        }\n        if ($show & self::OPTION_SHOW_MIGRATION) {\n            try {\n                $this->call('migrate:status');\n            } catch (\\Exception $e) {\n                $r = new ResultLens();\n                $r->add(\n                    \"Check migrate status\",\n                    \"Error in check migration\"\n                );\n                $ll->checksBag->addErrorAndHint(\n                    \"Migration status\",\n                    $e->getMessage(),\n                    \"Check the Database configuration\"\n                );\n                $this->printOutputTerm(\"Migration\", $r->toArray());\n            }\n        }\n        if ($show & self::OPTION_SHOW_PHPEXTENSIONS) {\n            $output = $ll->getPhpExtensions();\n            $this->printOutputTerm(\"PHP Extensions\", $output->toArray());\n        }\n        if ($show & self::OPTION_SHOW_PHPINIVALUES) {\n            $output = $ll->getPhpIniValues();\n            $this->printOutputTerm(\"PHP ini config\", $output->toArray());\n        }\n        if ($show & self::OPTION_SHOW_OS) {\n            $output = $ll->getOsConfigs();\n            $this->printOutputTerm(\"Operating System\", $output->toArray());\n        }\n        $this->printChecksTerm($ll->checksBag->toArray());\n    }\n\n\n    public function handle(): void\n    {\n        $op = $this->argument(\"op\");\n        $checkTable = $this->option(\"table\");\n        $styleTable = $this->option(\"style\");\n        $show = self::OPTION_SHOW_DEFAULT;\n        if (in_array($styleTable, explode(\"|\", self::TABLE_STYLES))) {\n            $this->styleTable = $styleTable;\n        } else {\n            $this->styleTable = self::DEFAULT_STYLE;\n        }\n        $columnSorting = $this->option(\"column-sort\");\n        $showOptions = $this->option(\"all\") ? ['all'] : $this->option(\"show\");\n\n\n        if (is_array($showOptions)) {\n            if (count($showOptions) > 0) {\n                $show = self::OPTION_SHOW_NONE;\n                if (in_array(\"all\", $showOptions)) {\n                    $show = self::OPTION_SHOW_ALL;\n                } else {\n                    $show = (in_array(\"config\", $showOptions)) ? $show | self::OPTION_SHOW_CONFIGS : $show ;\n                    $show = (in_array(\"runtime\", $showOptions)) ? $show | self::OPTION_SHOW_RUNTIMECONFIGS : $show ;\n                    $show = (in_array(\"connection\", $showOptions)) ? $show | self::OPTION_SHOW_CONNECTIONS : $show ;\n                    $show = (in_array(\"database\", $showOptions)) ? $show | self::OPTION_SHOW_DATABASE : $show ;\n                    $show = (in_array(\"migration\", $showOptions)) ? $show | self::OPTION_SHOW_MIGRATION : $show ;\n                    $show = (in_array(\"php-ext\", $showOptions)) ? $show | self::OPTION_SHOW_PHPEXTENSIONS : $show ;\n                    $show = (in_array(\"php-ini\", $showOptions)) ? $show | self::OPTION_SHOW_PHPINIVALUES : $show ;\n                    $show = (in_array(\"os\", $showOptions)) ? $show | self::OPTION_SHOW_OS : $show ;\n                }\n            } else {\n                $show = self::OPTION_SHOW_DEFAULT;\n            }\n        }\n        $skipDatabases = $this->option(\"skip-database\");\n        if ($skipDatabases) {\n            $show = $show - self::OPTION_SHOW_DATABASE - self::OPTION_SHOW_MIGRATION;\n        }\n\n        $this->widthLabel = $this->option(\"width-label\");\n        $this->widthValue = $this->option(\"width-value\");\n        if ($this->option(\"large\")) {\n            $this->widthValue = self::DEFAULT_LARGE_WIDTH;\n        }\n\n        $this->urlPath = $this->option(\"url-path\");\n        if (is_null($this->urlPath)) {\n            $this->urlPath = self::DEFAULT_PATH;\n        }\n        $version = \\Composer\\InstalledVersions::getPrettyVersion('hi-folks/lara-lens');\n        $this->title(\"Laralens (\" . $version . \")\");\n        match ($op) {\n            'overview' => $this->overview($checkTable, $columnSorting, $show),\n            'allconfigs' => $this->allConfigs(),\n            default => $this->info(\"What you mean? try with 'php artisan laralens:diagnostic --help'\"),\n        };\n    }\n}\n"
  },
  {
    "path": "src/Http/Controllers/Controller.php",
    "content": "<?php\n\nnamespace HiFolks\\LaraLens\\Http\\Controllers;\n\nuse Illuminate\\Foundation\\Bus\\DispatchesJobs;\nuse Illuminate\\Routing\\Controller as BaseController;\nuse Illuminate\\Foundation\\Validation\\ValidatesRequests;\nuse Illuminate\\Foundation\\Auth\\Access\\AuthorizesRequests;\n\nclass Controller extends BaseController\n{\n    use AuthorizesRequests;\n    use DispatchesJobs;\n    use ValidatesRequests;\n}\n"
  },
  {
    "path": "src/Http/Controllers/LaraLensController.php",
    "content": "<?php\n\nnamespace HiFolks\\LaraLens\\Http\\Controllers;\n\nuse HiFolks\\LaraLens\\Lens\\LaraLens;\n\nclass LaraLensController extends Controller\n{\n    public function index(): \\Illuminate\\View\\View\n    {\n        if (config('lara-lens.web-enabled') != 'on') {\n            abort(403, 'Unauthorized action.', ['X-Laralens' => 'off']);\n        }\n        $ll = new LaraLens();\n\n\n\n        $data = [\n            [\n                \"title\" => \"Check Server requirements\",\n                \"description\" => \"Check Server requirements\",\n                \"data\" => $ll->checkServerRequirements()->toArray()\n            ],\n            [\n                \"title\" => \"Configs\",\n                \"description\" => \"Config keys via config()\",\n                \"data\" => $ll->getConfigs()->toArray()\n            ],\n            [\n                \"title\" => \"Runtime\",\n                \"description\" => \"Laravel Runtime configs\",\n                \"data\" => $ll->getRuntimeConfigs()->toArray()\n            ],\n            [\n                \"title\" => \"Check files\",\n                \"description\" => \"Check files consistency / exists\",\n                \"data\" => $ll->checkFiles()->toArray()\n            ],\n            [\n                \"title\" => \"Connections\",\n                \"description\" => \"Check connections\",\n                \"data\" => $ll->getConnections('')->toArray()\n            ],\n            [\n                \"title\" => \"Database\",\n                \"description\" => \"Config Database\",\n                \"data\" => $ll->getDatabase()->toArray()\n            ],\n            [\n                \"title\" => \"PHP Extensions\",\n                \"description\" => \"List of PHP extensions loaded\",\n                \"data\" => $ll->getPhpExtensions()->toArray()\n            ],\n            [\n                \"title\" => \"PHP INI\",\n                \"description\" => \"List of php ini values\",\n                \"data\" => $ll->getPhpIniValues()->toArray()\n            ],\n            [\n                \"title\" => \"Credits\",\n                \"description\" => \"LaraLens app\",\n                \"data\" => $ll->getCredits()->toArray()\n            ],\n        ];\n\n        $checks = $ll->checksBag->toArray();\n\n        return view('lara-lens::laralens.index', ['data' => $data, 'checks' => $checks]);\n    }\n}\n"
  },
  {
    "path": "src/LaraLensFacade.php",
    "content": "<?php\n\nnamespace HiFolks\\LaraLens;\n\nuse Illuminate\\Support\\Facades\\Facade;\n\nclass LaraLensFacade extends Facade\n{\n    /**\n     * Get the registered name of the component.\n     *\n     * @return string\n     */\n    protected static function getFacadeAccessor()\n    {\n        return 'lara-lens';\n    }\n}\n"
  },
  {
    "path": "src/LaraLensServiceProvider.php",
    "content": "<?php\n\nnamespace HiFolks\\LaraLens;\n\nuse HiFolks\\LaraLens\\Console\\LaraLensCommand;\nuse Illuminate\\Support\\ServiceProvider;\nuse HiFolks\\LaraLens\\Lens\\LaraLens;\nuse Illuminate\\Support\\Facades\\Route;\n\nclass LaraLensServiceProvider extends ServiceProvider\n{\n    /**\n     * Bootstrap the application services.\n     */\n    public function boot(): void\n    {\n        /*\n         * Optional methods to load your package assets\n         */\n        // $this->loadTranslationsFrom(__DIR__.'/../resources/lang', 'lara-lens');\n        $this->loadViewsFrom(__DIR__ . '/../resources/views', 'lara-lens');\n        // $this->loadMigrationsFrom(__DIR__.'/../database/migrations');\n        //$this->loadRoutesFrom(__DIR__.'/routes.php');\n        $this->registerRoutes();\n\n        if ($this->app->runningInConsole()) {\n            $this->publishes(\n                [\n                __DIR__ . '/../config/config.php' => config_path('lara-lens.php'),\n                ],\n                'config'\n            );\n\n            // Publishing the views.\n            /*$this->publishes([\n                __DIR__.'/../resources/views' => resource_path('views/vendor/lara-lens'),\n            ], 'views');*/\n\n            // Publishing assets.\n            /*$this->publishes([\n                __DIR__.'/../resources/assets' => public_path('vendor/lara-lens'),\n            ], 'assets');*/\n\n            // Publishing the translation files.\n            /*$this->publishes([\n                __DIR__.'/../resources/lang' => resource_path('lang/vendor/lara-lens'),\n            ], 'lang');*/\n\n            // Registering package commands.\n            $this->commands(\n                [\n                LaraLensCommand::class,\n                ]\n            );\n        }\n    }\n\n\n    protected function registerRoutes(): void\n    {\n        Route::group($this->routeConfiguration(), function () {\n            $this->loadRoutesFrom(__DIR__ . '/../routes/web.php');\n        });\n    }\n\n    /**\n     * @return (\\Illuminate\\Config\\Repository|mixed)[]\n     *\n     * @psalm-return array{prefix: \\Illuminate\\Config\\Repository|mixed, middleware: \\Illuminate\\Config\\Repository|mixed}\n     */\n    protected function routeConfiguration(): array\n    {\n        return [\n            'prefix' => config('lara-lens.prefix', 'laralens-diagnostic'),\n            'middleware' => config('lara-lens.middleware'),\n        ];\n    }\n\n    /**\n     * Register the application services.\n     */\n    public function register()\n    {\n        // Automatically apply the package configuration\n        $this->mergeConfigFrom(__DIR__ . '/../config/config.php', 'lara-lens');\n\n        // Register the main class to use with the facade\n        $this->app->singleton(\n            'lara-lens',\n            fn () => new LaraLens()\n        );\n    }\n}\n"
  },
  {
    "path": "src/Lens/LaraHttp.php",
    "content": "<?php\n\nnamespace HiFolks\\LaraLens\\Lens;\n\nuse GuzzleHttp\\Client;\nuse GuzzleHttp\\Exception\\GuzzleException;\nuse HiFolks\\LaraLens\\Lens\\Objects\\LaraHttpResponse;\n\nclass LaraHttp\n{\n    public static function get($url): LaraHttpResponse\n    {\n        $client = new Client();\n        try {\n            $response = new LaraHttpResponse($client->get($url, ['timeout' => 1]));\n        } catch (GuzzleException $e) {\n            $response = null;\n            throw $e;\n        }\n        return $response;\n    }\n}\n"
  },
  {
    "path": "src/Lens/LaraLens.php",
    "content": "<?php\n\nnamespace HiFolks\\LaraLens\\Lens;\n\nuse HiFolks\\LaraLens\\Lens\\Traits\\ConfigLens;\nuse HiFolks\\LaraLens\\Lens\\Traits\\DatabaseLens;\nuse HiFolks\\LaraLens\\Lens\\Traits\\FilesystemLens;\nuse HiFolks\\LaraLens\\Lens\\Traits\\HttpConnectionLens;\nuse HiFolks\\LaraLens\\Lens\\Traits\\OperatingSystemLens;\nuse HiFolks\\LaraLens\\Lens\\Traits\\RuntimeLens;\nuse HiFolks\\LaraLens\\ResultLens;\n\nclass LaraLens\n{\n    use DatabaseLens;\n    use ConfigLens;\n    use HttpConnectionLens;\n    use RuntimeLens;\n    use FilesystemLens;\n    use OperatingSystemLens;\n\n    /**\n     * @var ResultLens\n     */\n    public $checksBag;\n\n    public function __construct()\n    {\n        $this->checksBag = new ResultLens();\n    }\n\n    /**\n     * @return ResultLens\n     */\n    public function getCredits()\n    {\n        $results = new ResultLens();\n        $results->add(\n            \"App\",\n            \"powered by LaraLens\"\n        );\n\n\n        return $results;\n    }\n\n\n    /**\n     * @return string\n     */\n    public static function printBool(bool $b)\n    {\n        return $b ? \"Yes\" : \"No\";\n    }\n}\n"
  },
  {
    "path": "src/Lens/Objects/LaraHttpResponse.php",
    "content": "<?php\n\nnamespace HiFolks\\LaraLens\\Lens\\Objects;\n\nuse Psr\\Http\\Message\\ResponseInterface;\n\nclass LaraHttpResponse\n{\n    /**\n     * LaraHttpResponse constructor.\n     */\n    public function __construct(private ResponseInterface $response)\n    {\n    }\n\n    /**\n     * Return the Http response status code.\n     *\n     * @return int\n     */\n    public function status()\n    {\n        return $this->response->getStatusCode();\n    }\n\n    /**\n     * Return true if the status code of the HTTP response is an error\n     *\n     * @return bool\n     */\n    public function failed()\n    {\n        return ($this->response->getStatusCode() >= 400);\n    }\n}\n"
  },
  {
    "path": "src/Lens/Traits/BaseTraits.php",
    "content": "<?php\n\nnamespace HiFolks\\LaraLens\\Lens\\Traits;\n\nuse Illuminate\\Support\\Str;\n\ntrait BaseTraits\n{\n    protected function stripPrefixDir($value)\n    {\n        //$curDir = getcwd();\n        $curDir = base_path();\n        if (Str::length($curDir) > 3) {\n            if (Str::startsWith($value, $curDir)) {\n                $value = \".\" . Str::after($value, $curDir);\n            }\n        }\n        return $value;\n    }\n}\n"
  },
  {
    "path": "src/Lens/Traits/ConfigLens.php",
    "content": "<?php\n\nnamespace HiFolks\\LaraLens\\Lens\\Traits;\n\nuse HiFolks\\LaraLens\\ResultLens;\n\ntrait ConfigLens\n{\n    public function getConfigsDatabaseFromEnv(ResultLens|null $results = null): \\HiFolks\\LaraLens\\ResultLens\n    {\n        if (is_null($results)) {\n            $results = new ResultLens();\n        }\n        $configKeys = [\n            \"DB_HOST\",\n            \"DB_DATABASE\",\n            \"DB_USERNAME\",\n            \"DB_CONNECTION\",\n            \"DB_PORT\"\n        ];\n        foreach ($configKeys as $key => $value) {\n            $results->add(\n                \".env \" . $value,\n                env($value)\n            );\n        }\n        return $results;\n    }\n\n    public function checkDebugEnv(ResultLens|null $results = null): \\HiFolks\\LaraLens\\ResultLens\n    {\n        if (is_null($results)) {\n            $results  = new ResultLens();\n        }\n        $debug = config(\"app.debug\");\n        $env = config(\"app.env\");\n        $results->add(\n            \"ENV\",\n            $env\n        );\n        $results->add(\n            \"DEBUG\",\n            $debug\n        );\n        if ($debug && $env === \"production\") {\n            $this->checksBag->addWarningAndHint(\n                \"Check config ENV and DEBUG\",\n                \"You have DEBUG mode in Production.\",\n                \"Change you APP_DEBUG env parameter to false for Production environments\"\n            );\n        }\n        return $results;\n    }\n\n    public function getConfigsDatabase(ResultLens|null $results = null): \\HiFolks\\LaraLens\\ResultLens\n    {\n        if (is_null($results)) {\n            $results = new ResultLens();\n        }\n        $configKeys = [\n            \"database.default\",\n            \"database.connections.\" . config(\"database.default\") . \".driver\",\n            \"database.connections.\" . config(\"database.default\") . \".url\",\n            \"database.connections.\" . config(\"database.default\") . \".host\",\n            \"database.connections.\" . config(\"database.default\") . \".port\",\n            \"database.connections.\" . config(\"database.default\") . \".username\",\n            \"database.connections.\" . config(\"database.default\") . \".database\"\n        ];\n        foreach ($configKeys as $key => $value) {\n            $results->add(\n                \"\" . $value,\n                config($value)\n            );\n        }\n        return $results;\n    }\n\n    public function getConfigs()\n    {\n        $results = new ResultLens();\n        $results->add(\n            \"Running diagnostic\",\n            date('Y-m-d H:i:s')\n        );\n        $configKeys = [\n            \"app.timezone\",\n            \"app.locale\",\n            \"app.name\",\n            \"app.url\",\n        ];\n        foreach ($configKeys as $key => $value) {\n            $results->add(\n                \"\" . $value,\n                config($value)\n            );\n        }\n        $results = $this->checkDebugEnv($results);\n        $results = $this->getConfigsDatabase($results);\n        return $results;\n    }\n}\n"
  },
  {
    "path": "src/Lens/Traits/DatabaseLens.php",
    "content": "<?php\n\nnamespace HiFolks\\LaraLens\\Lens\\Traits;\n\nuse Illuminate\\Database\\Connection;\nuse Illuminate\\Database\\QueryException;\nuse Illuminate\\Support\\Facades\\DB;\nuse Illuminate\\Support\\Str;\nuse HiFolks\\LaraLens\\ResultLens;\n\ntrait DatabaseLens\n{\n    public function getTablesListMysql(): string\n    {\n        $tables = DB::select('SHOW TABLES');\n        $stringTables = \"\";\n        foreach ($tables as $table) {\n            foreach ($table as $key => $value) {\n                $stringTables = $stringTables . $value . \";\";\n            }\n        }\n        return $stringTables;\n    }\n\n    public function getTablesListSqlite(): string\n    {\n        $tables = DB::table('sqlite_master')\n            ->select('name')\n            ->where('type', 'table')\n            ->orderBy('name')\n            ->pluck('name')->toArray();\n        $stringTables = implode(\",\", $tables);\n        return $stringTables;\n    }\n\n    /**\n     * Try to establish a db connection.\n     * If it fails, return FALSE and fill checksBag.\n     */\n    public function dbConnection(): false|\\Illuminate\\Database\\Connection\n    {\n        $dbconnection = false;\n        try {\n            $dbconnection = DB::connection();\n        } catch (\\Exception $e) {\n            $dbconnection = false;\n            $this->checksBag->addErrorAndHint(\n                \"Error Database connection\",\n                \"- \" . $e->getCode() . \" - \" . $e->getMessage(),\n                \"Check out your .env file for these parameters: DB_HOST, DB_DATABASE, DB_USERNAME, DB_PASSWORD\"\n            );\n        }\n        return $dbconnection;\n    }\n\n    public function getDatabaseConnectionInfos(\n        Connection $dbConnection,\n        ResultLens $results,\n        $checkTable,\n        $columnSorting\n    ) {\n        $connectionName = $dbConnection->getName();\n        $results->add(\n            \"Connection name\",\n            $connectionName\n        );\n        $grammar = $dbConnection->getQueryGrammar();\n        $results->add(\n            \"Query Grammar\",\n            Str::afterLast($grammar::class, '\\\\')\n        );\n        $driverName = $dbConnection->getDriverName();\n        $results->add(\n            \"Driver name\",\n            $driverName\n        );\n        $databaseName = $dbConnection->getDatabaseName();\n        $results->add(\n            \"Database name\",\n            $databaseName\n        );\n        $tablePrefix = $dbConnection->getTablePrefix();\n        $results->add(\n            \"Table prefix\",\n            $tablePrefix\n        );\n\n        $pdo = null;\n        $pdoIsOk = false;\n        try {\n            $pdo = $dbConnection->getPDO();\n            $pdoIsOk = true;\n        } catch (\\PDOException $e) {\n            $this->checksBag->addWarningAndHint(\n                \"Access to PDO (database)\",\n                $e->getMessage(),\n                \"Check .env DB_*\"\n            );\n        }\n\n        if (!$pdoIsOk) {\n            if ($driverName === \"mongodb\") {\n                $this->checksBag->addInfoAndHint(\n                    \"Connection and PDO driver\",\n                    \"It is ok! Because you are using \" . $driverName . \", and it doesn't support PDO driver.\",\n                    \"\"\n                );\n            } else {\n            }\n        } else {\n            try {\n                $serverVersion = $dbConnection->getPDO()->getAttribute(\\PDO::ATTR_SERVER_VERSION);\n                $results->add(\n                    \"Server version\",\n                    $serverVersion\n                );\n            } catch (\\PDOException $e) {\n                $results->addErrorAndHint(\n                    \"Error DB\",\n                    $e->getMessage(),\n                    \"Check out your .env file for these parameters: DB_HOST, DB_DATABASE, DB_USERNAME, DB_PASSWORD\"\n                );\n                $results = $this->getConfigsDatabase($results);\n                $results = $this->getConfigsDatabaseFromEnv($results);\n                return $results;\n            }\n\n\n            $connectionType = $dbConnection->getPDO()->getAttribute(\\PDO::ATTR_DRIVER_NAME);\n            $results->add(\n                \"Database connection type\",\n                $connectionType\n            );\n            $stringTables = \"\";\n            $stringTables = match ($connectionType) {\n                'mysql' => $this->getTablesListMysql(),\n                'sqlite' => $this->getTablesListSqlite(),\n                default => \"<<skipped \" . $connectionType . \">>\",\n            };\n            $results->add(\n                \"Tables\",\n                $stringTables\n            );\n\n            $checkCountMessage = \"\";\n            $checkCount = 0;\n            try {\n                $checkCount = DB::table($checkTable)\n                    ->select(DB::raw('*'))\n                    ->count();\n            } catch (\\Exception) {\n                $checkCount = 0;\n                $checkCountMessage = \" - error with \" . $checkTable . \" table\";\n                $results->addErrorAndHint(\n                    \"Table Error\",\n                    \"Failed query, table <\" . $checkTable . \"> \",\n                    \"Make sure that table <\" . $checkTable .\n                    \"> exists, available tables : \" .\n                    (($stringTables == \"\") ? \"Not tables found\" : $stringTables)\n                );\n            }\n\n            $results->add(\n                \"Query Table\",\n                $checkTable\n            );\n            $results->add(\n                \"Number of rows\",\n                $checkCount . $checkCountMessage\n            );\n            if ($checkCount > 0) {\n                try {\n                    $latest = DB::table($checkTable)->latest($columnSorting)->first();\n                    $results->add(\n                        \"LAST row in table\",\n                        json_encode($latest, JSON_THROW_ON_ERROR)\n                    );\n                } catch (QueryException) {\n                    $results->addErrorAndHint(\n                        \"Table Error\",\n                        \"Failed query, table <\" . $checkTable . \"> column <\" . $columnSorting . \">\",\n                        \"Make sure that table <\" . $checkTable . \"> column <\" . $columnSorting . \"> exists\"\n                    );\n                }\n            }\n        }\n    }\n\n    public function getDatabase($checkTable = \"users\", $columnSorting = \"created_at\"): \\HiFolks\\LaraLens\\ResultLens\n    {\n        $results = new ResultLens();\n\n        $dbConnection = $this->dbConnection();\n\n\n        $results->add(\n            \"Database default\",\n            config(\"database.default\")\n        );\n        if ($dbConnection) {\n            $this->getDatabaseConnectionInfos($dbConnection, $results, $checkTable, $columnSorting);\n        }\n\n\n\n\n\n        return $results;\n    }\n}\n"
  },
  {
    "path": "src/Lens/Traits/FilesystemLens.php",
    "content": "<?php\n\nnamespace HiFolks\\LaraLens\\Lens\\Traits;\n\nuse HiFolks\\LaraLens\\ResultLens;\nuse Illuminate\\Support\\Facades\\App;\n\ntrait FilesystemLens\n{\n    use BaseTraits;\n\n    protected function links()\n    {\n        return config(\"filesystems.links\") ??\n            [public_path('storage') => storage_path('app/public')];\n        //return $this->laravel['config']['filesystems.links'] ??\n    }\n    public function checkFiles(): \\HiFolks\\LaraLens\\ResultLens\n    {\n        $results = new ResultLens();\n        $envExists = file_exists(App::environmentFilePath());\n        if ($envExists) {\n            $results->add(\n                \"Check .env exists\",\n                self::printBool($envExists)\n            );\n        } else {\n            $results->addWarningAndHint(\n                \"Check .env exists\",\n                \".env not exists\",\n                \"Create .env file\"\n            );\n        }\n        $results->add(\n            \"Check Languages directory\",\n            self::printBool(is_dir(App::langPath()))\n        );\n        try {\n            $langArray = scandir(App::langPath());\n        } catch (\\Exception) {\n            $langArray = false;\n        }\n        $languages = \"\";\n        if ($langArray) {\n            $languages = implode(\",\", array_diff($langArray, ['..', '.', 'vendor']));\n        } else {\n            $languages = \"No language found\";\n            $this->checksBag->addWarningAndHint(\n                \"List Languages directory\",\n                \"No languages found in \" . App::langPath(),\n                \"If your app needs translations, please fill \" . App::langPath() . \" or run `php artisan lang:publish`\"\n            );\n        }\n        $results->add(\n            \"List Languages directory\",\n            $languages\n        );\n\n        foreach ($this->links() as $link => $dir) {\n            if (!file_exists($link)) {\n                $this->checksBag->addWarningAndHint(\n                    \"Check storage link\",\n                    $this->stripPrefixDir($link) . \" it doesn't exist.\",\n                    \"Check config/filesystem.php 'links' parameter, and execute 'php artisan storage:link'\"\n                );\n            }\n            if (!file_exists($dir)) {\n                $this->checksBag->addWarningAndHint(\n                    \"Check storage target link\",\n                    $this->stripPrefixDir($dir) . \" it doesn't exist.\",\n                    \"Create directory target (for storage link) : \" . $dir\n                );\n            }\n\n            $results->add(\n                \"Storage links:\",\n                \"\"\n            );\n            $results->add(\n                $this->stripPrefixDir($link),\n                $this->stripPrefixDir($dir)\n            );\n        }\n\n        return $results;\n    }\n}\n"
  },
  {
    "path": "src/Lens/Traits/HttpConnectionLens.php",
    "content": "<?php\n\nnamespace HiFolks\\LaraLens\\Lens\\Traits;\n\nuse HiFolks\\LaraLens\\Lens\\LaraHttp;\nuse HiFolks\\LaraLens\\ResultLens;\n\ntrait HttpConnectionLens\n{\n    public function getConnections($checkPath): \\HiFolks\\LaraLens\\ResultLens\n    {\n        $results = new ResultLens();\n        $app_url = config(\"app.url\");\n        $results->add(\n            \"app.url configuration\",\n            $app_url\n        );\n        $url = url($checkPath);\n        $results->add(\n            \"url()->full()\",\n            url()->full()\n        );\n        $results->add(\n            \"Connection HTTP URL\",\n            $url\n        );\n        try {\n            $response = LaraHttp::get($url);\n            $results->add(\n                \"Connection HTTP Status\",\n                $response->status()\n            );\n            if ($response->failed()) {\n                $checkUrlHint = \"Check APP_URL '\" . $app_url . \"' in .env file \";\n                if ($checkPath !== \"\") {\n                    $checkUrlHint .= \" or check this path: '\" . $checkPath . \"' in routing file (routes/web.php)\";\n                }\n                $this->checksBag->addWarningAndHint(\n                    \"Connection HTTP Status\",\n                    \"Connection response not 20x, status code: \" . $response->status() . \" for \" . $url,\n                    $checkUrlHint\n                );\n            }\n        } catch (\\Exception $e) {\n            $results->add(\n                \"Connection HTTP Status\",\n                \"Error connection\"\n            );\n            $this->checksBag->addErrorAndHint(\n                \"Connection HTTP Status\",\n                \"Connection Error: \" . $e->getMessage(),\n                \"Check this URL: \" . $app_url . \" in .env file APP_URL\"\n            );\n        }\n        return $results;\n    }\n}\n"
  },
  {
    "path": "src/Lens/Traits/OperatingSystemLens.php",
    "content": "<?php\n\nnamespace HiFolks\\LaraLens\\Lens\\Traits;\n\nuse HiFolks\\LaraLens\\ResultLens;\n\ntrait OperatingSystemLens\n{\n    private function getUnameValues($results): void\n    {\n        $modes =  [\n            \"s\" => \"Operating System\",\n            \"n\" => \"Hostname\",\n            \"r\" => \"Release name\",\n            \"v\" => \"Version info\",\n            \"m\" => \"Machine Name\",\n            \"a\" => \"Full infos\"\n        ];\n\n        foreach ($modes as $key => $title) {\n            $results->add(\n                $title,\n                php_uname($key)\n            );\n        }\n    }\n\n    public function getOsConfigs(): \\HiFolks\\LaraLens\\ResultLens\n    {\n        $results = new ResultLens();\n        $results->add(\n            \"PHP script owner's UID\",\n            getmyuid()\n        );\n        $results->add(\n            \"Current User\",\n            get_current_user()\n        );\n        $this->getUnameValues($results);\n        return $results;\n    }\n}\n"
  },
  {
    "path": "src/Lens/Traits/RuntimeLens.php",
    "content": "<?php\n\nnamespace HiFolks\\LaraLens\\Lens\\Traits;\n\nuse HiFolks\\LaraLens\\ResultLens;\nuse Illuminate\\Support\\Arr;\nuse Illuminate\\Support\\Str;\n\ntrait RuntimeLens\n{\n    private function appCaller($results, $functions): void\n    {\n        $curDir = getcwd();\n        foreach ($functions as $function => $label) {\n            $value = call_user_func(\"App::\" . $function);\n            if (Str::length($curDir) > 3) {\n                if (Str::startsWith($value, $curDir)) {\n                    $value = \".\" . Str::after($value, $curDir);\n                }\n            }\n            $results->add(\n                $label,\n                $value\n            );\n        }\n    }\n\n    private function getIniValues($results): void\n    {\n        $labels = [\n            \"post_max_size\",\n            \"upload_max_filesize\",\n        ];\n        foreach ($labels as $label) {\n            $results->add(\n                $label,\n                ini_get($label)\n            );\n        }\n    }\n\n    public function getRuntimeConfigs(): \\HiFolks\\LaraLens\\ResultLens\n    {\n        $results = new ResultLens();\n        $results->add(\n            \"PHP Version\",\n            phpversion()\n        );\n        $this->getIniValues($results);\n        $results->add(\n            \"Current Directory\",\n            getcwd()\n        );\n        $this->appCaller(\n            $results,\n            [\n                \"version\" => \"Laravel Version\",\n                \"getLocale\" => \"Locale\",\n                \"getNamespace\" => \"Application namespace\",\n                \"environment\" => \"Environment\",\n                \"environmentPath\" => \"Environment file directory\",\n                \"environmentFile\" => \"Environment file used\",\n                \"environmentFilePath\" => \"Full path to the environment file\",\n                \"langPath\" => \"Path to the language files\",\n                \"publicPath\" => \"Path to the public / web directory\",\n                \"storagePath\" => \"Storage directory\",\n                \"resourcePath\" => \"Resources directory\",\n                \"getCachedServicesPath\" => \"Path to the cached services.php\",\n                \"getCachedPackagesPath\" => \"Path to the cached packages.php\",\n                \"getCachedConfigPath\" => \"Path to the configuration cache\",\n                \"getCachedRoutesPath\" => \"Path to the routes cache\",\n                \"getCachedEventsPath\" => \"Path to the events cache file\"\n            ]\n        );\n        $results->add(\n            \"Generated url for / \",\n            url(\"/\")\n        );\n        $results->add(\n            \"Generated asset url for /test.js \",\n            asset(\"/test.js\")\n        );\n        return $results;\n    }\n\n    public function checkServerRequirements(): \\HiFolks\\LaraLens\\ResultLens\n    {\n        $results = new ResultLens();\n\n        $phpVersion = phpversion();\n        $laravelVersion = app()->version();\n        $laravelMajorVersion = Arr::get(explode('.', $laravelVersion), 0, \"8\");\n\n        $phpExtensionRequirements = [\n            \"6\" => [\n                \"phpversion\" => \"7.2.0\",\n                \"extensions\" => [\n                    \"bcmath\",\n                    \"ctype\",\n                    \"fileinfo\",\n                    \"json\",\n                    \"mbstring\",\n                    \"openssl\",\n                    \"pdo\",\n                    \"tokenizer\",\n                    \"xml\"\n                ]\n            ],\n            \"7\" => [\n                \"phpversion\" => \"7.2.5\",\n                \"extensions\" => [\n                    \"bcmath\",\n                    \"ctype\",\n                    \"fileinfo\",\n                    \"json\",\n                    \"mbstring\",\n                    \"openssl\",\n                    \"pdo\",\n                    \"tokenizer\",\n                    \"xml\"\n                ]\n            ],\n            \"8\" => [\n                \"phpversion\" => \"7.3.0\",\n                \"extensions\" => [\n                    \"bcmath\",\n                    \"ctype\",\n                    \"fileinfo\",\n                    \"json\",\n                    \"mbstring\",\n                    \"openssl\",\n                    \"pdo\",\n                    \"tokenizer\",\n                    \"xml\"\n                ]\n            ],\n            \"9\" => [\n                \"phpversion\" => \"8.0.2\",\n                \"extensions\" => [\n                    \"bcmath\",\n                    \"ctype\",\n                    \"fileinfo\",\n                    \"json\",\n                    \"mbstring\",\n                    \"openssl\",\n                    \"pdo\",\n                    \"tokenizer\",\n                    \"xml\"\n                ]\n            ],\n            \"10\" => [\n                \"phpversion\" => \"8.1.0\",\n                \"extensions\" => [\n                    \"bcmath\",\n                    \"ctype\",\n                    \"curl\",\n                    \"dom\",\n                    \"fileinfo\",\n                    \"json\",\n                    \"mbstring\",\n                    \"openssl\",\n                    \"pcre\",\n                    \"pdo\",\n                    \"tokenizer\",\n                    \"xml\"\n                ]\n            ],\n            \"11\" => [\n                \"phpversion\" => \"8.2.0\",\n                \"extensions\" => [\n                    \"ctype\",\n                    \"curl\",\n                    \"dom\",\n                    \"fileinfo\",\n                    \"filter\",\n                    \"json\",\n                    \"libxml\",\n                    \"mbstring\",\n                    \"openssl\",\n                    \"pcre\",\n                    \"phar\",\n                    \"reflection\",\n                    \"simplexml\",\n                    \"spl\",\n                    \"tokenizer\",\n                    \"xml\",\n                    \"xmlwriter\"\n                ]\n            ]\n\n        ];\n        if (!key_exists($laravelMajorVersion, $phpExtensionRequirements)) {\n            $laravelMajorVersion = \"11\";\n        }\n        $phpVersionRequired = $phpExtensionRequirements[$laravelMajorVersion][\"phpversion\"];\n        $results->add(\n            \"Laravel version\",\n            $laravelVersion . \" ( \" . $laravelMajorVersion . \" )\"\n        );\n        $results->add(\n            \"PHP version\",\n            $phpVersion\n        );\n        $results->add(\n            \"PHP version required (min)\",\n            $phpVersionRequired\n        );\n\n        $helpInstall = [\n            \"bcmath\" => \"BCMath Arbitrary Precision Mathematics: https://www.php.net/manual/en/bc.setup.php\",\n            \"ctype\" => \"Character type checking: https://www.php.net/manual/en/book.ctype\",\n            \"curl\" => \"Client URL Library: https://www.php.net/manual/en/book.curl.php\",\n            \"dom\" => \"Document Object Model: https://www.php.net/manual/en/book.dom.php\",\n            \"fileinfo\" => \"File Information: https://www.php.net/manual/en/book.fileinfo\",\n            \"filter\" => \"Data Filtering: https://www.php.net/manual/en/book.filter.php\",\n            \"json\" => \"JavaScript Object Notation: https://www.php.net/manual/en/book.json\",\n            \"libxml\" => \"libxml: https://www.php.net/manual/en/book.libxml.php\",\n            \"mbstring\" => \"Multibyte string: https://www.php.net/manual/en/book.mbstring.php\",\n            \"openssl\" => \"OpenSSL: https://www.php.net/manual/en/book.openssl.php\",\n            \"pcre\" => \"Regular Expressions (Perl-Compatible): https://www.php.net/manual/en/book.pcre.php\",\n            \"pdo\" => \"PHP Data Objects: https://www.php.net/manual/en/book.pdo.php\",\n            \"phar\" => \"Phar: https://www.php.net/manual/en/book.phar.php\",\n            \"reflection\" => \"Reflection: https://www.php.net/manual/en/book.reflection.php\",\n            \"simplexml\" => \"SimpleXML: https://www.php.net/manual/en/book.simplexml.php\",\n            \"spl\" => \"Standard PHP Library (SPL): https://www.php.net/manual/en/book.spl.php\",\n            \"tokenizer\" => \"Tokenizer: https://www.php.net/manual/en/book.tokenizer.php\",\n            \"xml\" => \"XML Parser: https://www.php.net/manual/en/book.xml.php\",\n            \"xmlwriter\" => \"XMLWriter: https://www.php.net/manual/en/book.xmlwriter.php\"\n        ];\n        $modulesOk = [];\n        $modulesNotok = [];\n        foreach ($phpExtensionRequirements[$laravelMajorVersion][\"extensions\"] as $p) {\n            if (extension_loaded($p)) {\n                $modulesOk[] = $p;\n            } else {\n                $modulesNotok[] = $p;\n            }\n        }\n        //*** CHECK PHP VERSION\n        if (version_compare($phpVersion, $phpVersionRequired) < 0) {\n            $this->checksBag->addWarningAndHint(\n                \"PHP (\" . $phpVersion . \") version check\",\n                \"PHP version required: \" . $phpVersionRequired . \", you have: \" . $phpVersion,\n                \"You need to install PHP version: \" . $phpVersionRequired\n            );\n        }\n        $results->add(\n            \"PHP (\" . $phpVersion . \") version check\",\n            \"PHP version required: \" . $phpVersionRequired . \", you have: \" . $phpVersion\n        );\n        $results->add(\n            \"PHP extensions installed\",\n            implode(\",\", $modulesOk)\n        );\n        if (count($modulesNotok) > 0) {\n            $stringHint = \"Please install these modules :\" . PHP_EOL;\n            foreach ($modulesNotok as $pko) {\n                if (key_exists($pko, $helpInstall)) {\n                    $stringHint = $pko . \" : \" . $helpInstall[$pko] . PHP_EOL;\n                } else {\n                    $stringHint = $pko . PHP_EOL;\n                }\n            }\n            $this->checksBag->addWarningAndHint(\n                \"PHP extensions missing\",\n                \"Some PHP Extensions are missing\",\n                $stringHint\n            );\n        } else {\n            $results->add(\n                \"PHP extension installed\",\n                \"Looks good for Laravel \" . $laravelMajorVersion\n            );\n        }\n        return $results;\n    }\n\n    public function getPhpExtensions(): \\HiFolks\\LaraLens\\ResultLens\n    {\n        $results = new ResultLens();\n        foreach (get_loaded_extensions() as $name) {\n            $results->add(\n                $name,\n                \"\"\n            );\n        }\n        return $results;\n    }\n\n    public function getPhpIniValues(): \\HiFolks\\LaraLens\\ResultLens\n    {\n        $results = new ResultLens();\n        foreach (ini_get_all() as $name => $row) {\n            $results->add(\n                $name,\n                $row['local_value']\n            );\n        }\n        return $results;\n    }\n}\n"
  },
  {
    "path": "src/Lens/Traits/TermOutput.php",
    "content": "<?php\n\nnamespace HiFolks\\LaraLens\\Lens\\Traits;\n\nuse function Termwind\\{render};\n\ntrait TermOutput\n{\n    public function printOutputTerm(\n        string $title,\n        array $rows\n    ) {\n        render(\n            view('lara-lens::laralens.term.table', [\n                'title' => $title,\n                'rows' => $rows\n            ])\n        );\n    }\n\n    public function printChecksTerm(array $rows): void\n    {\n        render(\n            view('lara-lens::laralens.term.checks', [\n                'rows' => $rows\n            ])\n        );\n    }\n    public function title(string $title): void\n    {\n        render(\"<div class='w-full mx-1 py-1 mt-1 text-center font-bold  bg-orange text-white'>$title</div>\");\n    }\n}\n"
  },
  {
    "path": "src/ResultLens.php",
    "content": "<?php\n\nnamespace HiFolks\\LaraLens;\n\nclass ResultLens\n{\n    private $result = null;\n    private int $idx = -1;\n\n    public const LINE_TYPE_ERROR   = 'error';\n    public const LINE_TYPE_WARNING = 'warning';\n    public const LINE_TYPE_INFO = 'info';\n    public const LINE_TYPE_HINT    = 'hint';\n    public const LINE_TYPE_DEFAULT = 'default';\n\n\n    public function __construct()\n    {\n        $this->reset();\n    }\n\n    public function reset(): void\n    {\n        $this->result = collect();\n        $this->idx = -1;\n    }\n\n    public function addError($label, $value): void\n    {\n        $this->add($label, $value, true, self::LINE_TYPE_ERROR);\n    }\n\n    public function addWarning($label, $value): void\n    {\n        $this->add($label, $value, true, self::LINE_TYPE_WARNING);\n    }\n    public function addInfo($label, $value): void\n    {\n        $this->add($label, $value, true, self::LINE_TYPE_INFO);\n    }\n\n\n    public function addHint($value): void\n    {\n        $this->add(\"*** HINT\", $value, true, self::LINE_TYPE_HINT);\n    }\n    public function addErrorAndHint($label, $errorMessage, $hintMessage): void\n    {\n        $this->addError($label, $errorMessage);\n        $this->addHint($hintMessage);\n    }\n    public function addWarningAndHint($label, $warningMessage, $hintMessage): void\n    {\n        $this->addWarning($label, $warningMessage);\n        $this->addHint($hintMessage);\n    }\n    public function addInfoAndHint($label, $infoMessage, $hintMessage): void\n    {\n        $this->addInfo($label, $infoMessage);\n        $this->addHint($hintMessage);\n    }\n\n    public function add($label, $value, $forceLine = false, $lineType = self::LINE_TYPE_DEFAULT): void\n    {\n        $this->result->push(\n            [\n                \"label\" => $label,\n                \"value\" => $value,\n                \"isLine\" => $forceLine,\n                \"lineType\" => $lineType\n            ]\n        );\n        $this->idx++;\n    }\n\n    /**\n     * @return bool\n     */\n    public static function isMessageLine(string $lineType)\n    {\n        return (($lineType === self::LINE_TYPE_ERROR) ||\n            ($lineType === self::LINE_TYPE_WARNING) ||\n            ($lineType === self::LINE_TYPE_INFO));\n    }\n    public static function isHintLine($lineType): bool\n    {\n        return ($lineType === self::LINE_TYPE_HINT);\n    }\n\n\n    public function toArray()\n    {\n        return $this->result->toArray();\n    }\n}\n"
  },
  {
    "path": "tests/Feature/ConsistencyTest.php",
    "content": "<?php\n\nuse Illuminate\\Support\\Facades\\Http;\n\ntest('config_array', function () {\n    expect(laralens())->getConfigs()\n    ->toArray()\n    ->toBeArray()\n    ->toHaveCount(14)\n    ->checksBag->toArray()\n    ->toBeArray()\n    ->toBeEmpty(); //test check config length 0\n\n\n    config(['app.debug' => true]);\n    config(['app.env' => \"production\"]);\n\n    expect(laralens())->getConfigs()\n    ->toArray()\n    ->toBeArray()\n    ->toHaveCount(14)\n    ->checksBag->toArray()\n    ->toBeArray()\n    ->toHaveCount(2);  // 2 =  1 for the warning , 1 for the hint\n});\n\nit('can retrieve runtimeconfig as array of 22 items')\n    ->expect(fn () => laralens())\n    ->getRuntimeConfigs()->toArray()\n    ->toBeArray()\n    ->toHaveCount(22);\n\nit('can retrieve databases as array with 8-13 items')\n    ->expect(fn () => laralens())\n    ->getDatabase()->toArray()\n    ->toBeArray()\n    ->toHaveCountBetween(8, 13);\n\ntest('facade', function () {\n    $this->assertIsObject($this->app[\"lara-lens\"], \"Test object facade\");\n});\n\ntest('Credits returned as non-empty array')\n    ->expect(fn () => laralens())\n    ->getCredits()->toArray()\n    ->toBeArray()\n    ->not()->toBeEmpty();\n\nit('can retrieve PHP extensions as array')\n    ->expect(fn () => laralens())\n    ->getPhpExtensions()->toArray()\n    ->toBeArray()\n    ->not()->toBeEmpty();\n\nit('can retrieve PHP ini as array')\n    ->expect(fn () => laralens())\n    ->getPhpIniValues()->toArray()\n    ->toBeArray()\n    ->not()->toBeEmpty();\n\nit('can retrieve OS config as array')\n    ->expect(fn () => laralens())\n    ->getOsConfigs()->toArray()\n    ->toBeArray()\n    ->toHaveCountBetween(0, 8);\n\ntest('connection_array', function () {\n    Http::fake();\n\n    expect(fn () => laralens())\n        ->getConnections()->toArray()\n        ->toBeArray()\n        ->toHaveCount(3);\n})->skip();\n"
  },
  {
    "path": "tests/Pest.php",
    "content": "<?php\n\n\nuse HiFolks\\LaraLens\\Lens\\LaraLens;\nuse HiFolks\\LaraLens\\Tests\\TestCase;\n\n/*\n|--------------------------------------------------------------------------\n| Test Case\n|--------------------------------------------------------------------------\n|\n| The closure you provide to your test functions is always bound to a specific PHPUnit test\n| case class. By default, that class is \"PHPUnit\\Framework\\TestCase\". Of course, you may\n| need to change it using the \"uses()\" function to bind a different classes or traits.\n|\n*/\n\nuses(TestCase::class)->in('Feature');\n\n/*\n|--------------------------------------------------------------------------\n| Expectations\n|--------------------------------------------------------------------------\n|\n| When you're writing tests, you often need to check that values meet certain conditions. The\n| \"expect()\" function gives you access to a set of \"expectations\" methods that you can use\n| to assert different things. Of course, you may extend the Expectation API at any time.\n|\n*/\n\nexpect()->extend('toHaveCountBetween', function (int $min, int $max) {\n    expect(count($this->value))->toBeGreaterThanOrEqual($min)\n                ->toBeLessThanOrEqual($max);\n    return $this;\n});\n\n\n/*\n|--------------------------------------------------------------------------\n| Functions\n|--------------------------------------------------------------------------\n|\n| While Pest is very powerful out-of-the-box, you may have some testing code specific to your\n| project that you don't want to repeat in every file. Here you can also expose helpers as\n| global functions to help you to reduce the number of lines of code in your test files.\n|\n*/\n\n/**\n * Returns a new instance of Laralens\n *\n * @return LaraLens\n */\nfunction laralens(): LaraLens\n{\n    return new LaraLens();\n}\n"
  },
  {
    "path": "tests/TestCase.php",
    "content": "<?php\n\nnamespace HiFolks\\LaraLens\\Tests;\n\nuse HiFolks\\LaraLens\\LaraLensServiceProvider;\nuse Orchestra\\Testbench\\TestCase as OrchestraTestCase;\n\nclass TestCase extends OrchestraTestCase\n{\n    protected function getPackageProviders($app)\n    {\n        return [LaraLensServiceProvider::class];\n    }\n}\n"
  }
]