Full Code of Hi-Folks/lara-lens for AI

develop f323ffc47f52 cached
42 files
85.6 KB
22.2k tokens
73 symbols
1 requests
Download .txt
Repository: Hi-Folks/lara-lens
Branch: develop
Commit: f323ffc47f52
Files: 42
Total size: 85.6 KB

Directory structure:
gitextract_66wvtac2/

├── .editorconfig
├── .gitattributes
├── .github/
│   └── workflows/
│       ├── php-code-quality.yml
│       └── php-lint.yml
├── .gitignore
├── CHANGELOG.md
├── CONTRIBUTING.md
├── LICENSE.md
├── README.md
├── composer.json
├── config/
│   └── config.php
├── phpcs.xml
├── phpstan.neon
├── phpunit.xml.dist
├── phpunit.xml.dist.bak
├── pint.json
├── psalm.xml
├── rector.php
├── resources/
│   └── views/
│       └── laralens/
│           ├── index.blade.php
│           └── term/
│               ├── checks.blade.php
│               └── table.blade.php
├── routes/
│   └── web.php
├── src/
│   ├── Console/
│   │   └── LaraLensCommand.php
│   ├── Http/
│   │   └── Controllers/
│   │       ├── Controller.php
│   │       └── LaraLensController.php
│   ├── LaraLensFacade.php
│   ├── LaraLensServiceProvider.php
│   ├── Lens/
│   │   ├── LaraHttp.php
│   │   ├── LaraLens.php
│   │   ├── Objects/
│   │   │   └── LaraHttpResponse.php
│   │   └── Traits/
│   │       ├── BaseTraits.php
│   │       ├── ConfigLens.php
│   │       ├── DatabaseLens.php
│   │       ├── FilesystemLens.php
│   │       ├── HttpConnectionLens.php
│   │       ├── OperatingSystemLens.php
│   │       ├── RuntimeLens.php
│   │       └── TermOutput.php
│   └── ResultLens.php
└── tests/
    ├── Feature/
    │   └── ConsistencyTest.php
    ├── Pest.php
    └── TestCase.php

================================================
FILE CONTENTS
================================================

================================================
FILE: .editorconfig
================================================
; This file is for unifying the coding style for different editors and IDEs.
; More information at http://editorconfig.org

root = true

[*]
charset = utf-8
indent_size = 4
indent_style = space
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false


================================================
FILE: .gitattributes
================================================
# Path-based git attributes
# https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html

# Ignore all test and documentation with "export-ignore".
/.gitattributes     export-ignore
/.gitignore         export-ignore
/.travis.yml        export-ignore
/phpunit.xml.dist   export-ignore
/.scrutinizer.yml   export-ignore
/tests              export-ignore
/.editorconfig      export-ignore


================================================
FILE: .github/workflows/php-code-quality.yml
================================================
name: Code Quality Workflow
on:
  push:
    branches:
      - develop
      - features/**
      - feature/**
      - upgrade/**
  pull_request:
      branches: [ develop ]

jobs:
  laravel-tests:
    strategy:
        matrix:
            operating-system: [ubuntu-latest]
            php-versions: [ '8.4', '8.3', '8.2', '8.1' ]
            dependency-stability: [ 'prefer-stable','prefer-lowest' ]

    runs-on: ${{ matrix.operating-system }}


    name: Test P${{ matrix.php-versions }} - L${{ matrix.laravel }} - ${{ matrix.dependency-stability }} - ${{ matrix.operating-system}}

    steps:
    - uses: actions/checkout@v4
    - name: Install PHP versions
      uses: shivammathur/setup-php@v2
      with:
        php-version: ${{ matrix.php-versions }}
    - name: Install Dependencies
      run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist

    - name: Update Dependencies with latest stable
      if: matrix.dependency-stability == 'prefer-stable'
      run: composer update --prefer-stable
    - name: Update Dependencies with lowest stable
      if: matrix.dependency-stability == 'prefer-lowest'
      run: composer update --prefer-stable --prefer-lowest

# Code quality
    - name: Execute tests (Unit and Feature tests) via PHPUnit
      env:
        SESSION_DRIVER: array
      run: composer test


  laravel-check:
    strategy:
        matrix:
            operating-system: [ubuntu-latest]
            php-versions: [ '8.3' ]

    runs-on: ${{ matrix.operating-system }}


    name: Check P${{ matrix.php-versions }} - ${{ matrix.operating-system}}

    steps:
    - uses: actions/checkout@v4
    - name: Install PHP versions
      uses: shivammathur/setup-php@v2
      with:
        php-version: ${{ matrix.php-versions }}
    - name: Install Dependencies
      run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist

    - name: Execute Code Sniffer via phpcs
      run: |
        composer style-fix

    - name: Execute Code Static Analysis (PHP Stan + Larastan)
      run: |
        composer phpstan


================================================
FILE: .github/workflows/php-lint.yml
================================================
name: PHP Syntax Checker (Lint)

on:
  push:
    branches: [ develop ]
  pull_request:
    branches: [ develop ]

jobs:
  build:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v4


    - name: Validate composer.json and composer.lock
      run: composer validate

    - name: Install dependencies
      run: composer install --prefer-dist --no-progress

    - name: Run test suite
      run: composer run-script test

    - name: PHP Syntax Checker (Lint)
      uses: StephaneBour/actions-php-lint@8.3
      with:
        dir: './src'


================================================
FILE: .gitignore
================================================
build
docs
composer.lock
vendor
coverage
.phpunit.result.cache
.phpunit.cache/
.idea
.php_cs.cache
.vscode


================================================
FILE: CHANGELOG.md
================================================
# Changelog

## 1.0.1 - 2024-11-29
- Upgrade to PHP 8.4

## 1.0.0 - 2024-03-13
- upgrading packages

## 0.5.2 - 2024-03-12
- Updating hints for missing lang directory

## 0.5.1 - 2024-03-07
- Detect dependencies for Laravel 11

## 0.5.0 - 2024-03-07
- Support for Laravel 11

## 0.4.1 - 2023-11-18
- Testing with PHP 8.3
- Adding title helper in the TermOutput
- Adding RectorPHP in the code quality tools

## 0.4.0 - 2023-02-04
- Support for Laravel 10
- Add requirements check for Laravel 10
- GitHub Actions Workflows: cleaning and fine-tuning
- Using Pint for Check styleguide (PSR12)
- Using PestPHP for testing
- Removing Makefile and using composer scripts to launching code quality tools
- migrating tests from PHPUnit to PestPHP, thanks to @dansysanalyst
- Fix skip-database option, now with works with all "show" options. Before the fix it worked only with "show all" option.

## 0.3.1- 2022-07-17
- Fine tuning dependencies for PHP 8.1, and Symfony / Doctrine packages
- Drop supprt for PHP7.4, for older PHP and Laravel, use Laralens v0.2.x


## 0.3.0 - 2022-07-17
- Add Termwind package
- Review console output, thanks also to @exodusanto
- Support for PHP 8.0 and greater

## 0.2.7 - 2022-01-23
- Add Support for Laravel 9
- Add tests for PHP8.1
- Drop support for PHP7.3
- Some fine tuning for Static Code analysis

## 0.2.6 - 2021-10-03
Hacktoberfest!!!
We would like to say thank you to @tweichart and @martijnengler for the contributions.
### Add
- Add --all option for showing all information (verbose output). Thanks to @tweichart
- Add --large option for using 120 chars width. Thanks to @martijnengler

## 0.2.5 - 2021-06-18
### Add
- Add some Operating System information:
    - PHP script owner's UID
    - Current User
    - Operating System
    - Hostname
    - Release name
    - Machine Name
    - Version info

## 0.2.4 - 2021-04-18
### Add
- In runtime information, added upload_max_filesize and post_max_size from php configuration ( thanks to @yogendra-revanna )

## 0.2.3 - 2021-04-10
### Add
- Check DEBUG and ENV configuration for production (if production avoid having debug on);
- Check Storage Links and show the user a waring if some directory links are missing

### Change
- improve tests and checks script for Workflows

## 0.2.2 - 2020-11-05
### Add
- Add configuration parameters (config/lara-lens.php) for managing webview: LARALENS_PREFIX, LARALENS_MIDDLEWARE, LARALENS_WEB_ENABLED, thanks to @yogendra-revanna, @JexPY, @Zuruckt;
- Initial support for PHP8-rc;



## 0.2.1 - 2020-09-22
### Add
- Show available PHP extension via --show=php-ext option  (thanks to https://github.com/yogendra-revanna);
- Show PHP ini configuration via --show=php-ini (thanks to https://github.com/yogendra-revanna).

### Change
- 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.

## 0.2.0 - 2020-09-20
### Add
- You can watch your LaraLens report with your browser (not just with your terminal);
- Makefile to manage development tasks;
- Add a _timeout_ when checking HTTP connection;
- CI/CD: Add Caching vendors in GitHub actions pipeline.

### Change
- DOCS: Update README, add some docs about skip database connection and database.

## 0.1.20 - 2020-09-11
### Fix
Thanks to [phpstan](https://github.com/phpstan/phpstan) :
- using $line instead of $row
- initialize correctly $show
- re throw exception for HTTP connection


## 0.1.19 - 2020-09-11
### Add
- 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);

### Change
- Code more PSR2 compliant (phpcs);
- Fix LaraHttpResponse::status(). The method returns the http status code. Close #19


## 0.1.18 - 2020-09-05
### Add
- Support for Laravel 8

## 0.1.17 - 2020-08-30
### Add
- Adding support for Laravel 6
- Check server requirements for  PHP modules needed by Laravel;
- Check server requirements for PHP Version (based on the Laravel version);
- Adding PORT display for Database connection;
- List PHP modules installed, needed by Laravel;

### Change
- Updating test cases

## 0.1.16 - 2020-08-19
### Add
- Adding php linter in CI/CD. We use php 7.2 linter for incoming support to Laravel 6.
### Fix
- Fix syntax in DatabaseLens.php. Close #17 ;

## 0.1.15 - 2020-08-09

### Add
- Add --url-path for using a specific path during HTTP connection. For example --url-path=test (for checking "test" path)
### Change
- Refactor logic with traits for: database connection, configuration, runtime parameters, filesystem, http connections (issue #11);
- Improve the HTTP Connection check (configuration url, url generated)


## 0.1.14 - 2020-08-04

- Refactoring "check" functionality
- add warning messages
- show report check
- add alert green
- managing multiple type of message (warning / error / hint)
- try catch for db connection, for checking files, for scanning directories
- check PDO for database connection


## 0.1.13 - 2020-07-31

### Add
- Add hints for database tables (table exists, column exists)
### Change
- Fix typo in banner.  ( close #6 )
- updated tests


## 0.1.12 - 2020-07-25

### Add
- When a check is not working properly, now it is displayed some hints;
- Add hints for database connection;
- Add hints for HTTP connections.

## 0.1.11 - 2020-07-12

### Add

### Change
- Improved list of languages;
- Update readme

## 0.1.10 - 2020-06-25

### Add
New function for check files.
- check .env file
- check language storage
- list languages available

## 0.1.9 - 2020-06-18

### Add

New runtime config about some paths:

* "langPath" =>"Path to the language files",
* "publicPath" =>" Path to the public / web directory",
* "storagePath" => "Storage directory",
* "resourcePath" =>"Resources directory",
* "getCachedServicesPath" => "Path to the cached services.php",
* "getCachedPackagesPath" => "Path to the cached packages.php",
* "getCachedConfigPath" => "Path to the configuration cache",
* "getCachedRoutesPath" => "Path to the routes cache",
* "getCachedEventsPath" => "Path to the events cache file",
* "getNamespace" => "Application namespace"

## 0.1.8 - 2020-06-18

### Add

:nail_care: Style output table via --style option. You can choose one of these styles (box-double is the default used by LaraLens):
* default
* borderless
* compact
* symfony-style-guide
* box
* box-double

:eyeglasses: Runtime config:
* environmentPath
* environmentFile
* environmentFilePath

### Change

* Refactor for App::"function"()
* update tests
* update readme
* update help (-h)

## 0.1.7 - 2020-06-16

### Add

Database connection:
* connection name
* getQueryGrammar
* getDriverName
* getDatabaseName
* getTablePrefix
* database server version

Runtime configuration:
* Laravel version
* PHP version

## 0.1.6 - 2020-06-01

### Add

* Add show option --show (all|config|runtime|connection|database|migration)

## 0.1.5 - 2020-05-29

### Improve

* managing a better output
* extracting long message from tables
* settings width for columns tables


## 0.1.4 - 2020-05-28

### Fix

* Catch HTTP connection exception

## 0.1.3 - 2020-05-27

### Add

* detect DB connection type;
* get tables for mysql;
* get tables for sqlite;
* count and retrieve last row from a table. Table and column name are as input parameters;
* test database diagnostics;
* update readme for documentation.


## 0.1.2 - 2020-05-22

### Add

* Add new argument as input (it is optional):
    - overview: you can see configuration, http connection, db connection etc.;
    - 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.

## 0.1.1 - 2020-05-22

### Add

* Add runtime config:
    * App::getLocale()
    * App::environment())
    * Generated url via asset() and url() helpers
* Invoke migrate:status

## 0.1.0 - 2020-05-21

* :tada: initial release
* Add laralens:diagnostic artisan command (Laravel)
* Check config parameter like app.url, app.locale, app.url and database.*
* Check the http connection with "app.url" defined in base configuration
* Check the connection with DB and counts the row for a specific table (users by default)


================================================
FILE: CONTRIBUTING.md
================================================
# Contributing

Contributions are **welcome** and will be fully **credited**.

Please read and understand the contribution guide before creating an issue or pull request.

## Etiquette

This project is open source, and as such, the maintainers give their free time to build and maintain the source code
held within. They make the code freely available in the hope that it will be of use to other developers. It would be
extremely unfair for them to suffer abuse or anger for their hard work.

Please be considerate towards maintainers when raising issues or presenting pull requests. Let's show the
world that developers are civilized and selfless people.

It's the duty of the maintainer to ensure that all submissions to the project are of sufficient
quality 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.

## Viability

When requesting or submitting new features, first consider whether it might be useful to others. Open
source projects are used by many developers, who may have entirely different needs to your own. Think about
whether or not your feature is likely to be used by other users of the project.

## Procedure

Before filing an issue:

- Attempt to replicate the problem, to ensure that it wasn't a coincidental incident.
- Check to make sure your feature suggestion isn't already present within the project.
- Check the pull requests tab to ensure that the bug doesn't have a fix in progress.
- Check the pull requests tab to ensure that the feature isn't already in progress.

Before submitting a pull request:

- Check the codebase to ensure that your feature doesn't already exist.
- Check the pull requests to ensure that another person hasn't already submitted the feature or fix.

## Open a Pull Request

In order to maintain consistency in the source code we are following PSR12 coding standard, and using PHP stan for static code analysis.
You can use the command:
```
make allcheck
```
to launch
- **[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);
- **PHPstan** with [level 5](https://phpstan.org/user-guide/rule-levels)
- **PestPHP** to execute all tests from ./tests/*

I suggest to launch *composer all* before to commit or before to create PR.

If 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.

If you want to contribute with an high quality PR, I suggest you to focus not just on the source code but also:

- **Add tests!** - Your patch won't be accepted if it doesn't have tests.

- **Document any change in behaviour** - Make sure the `README.md` and any other relevant documentation are kept up-to-date.

- **Consider our release cycle** - We try to follow [SemVer v2.0.0](https://semver.org/). Randomly breaking public APIs is not an option.

- **One pull request per feature** - If you want to do more than one thing, send multiple pull requests.

- **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.

**Happy coding**!


================================================
FILE: LICENSE.md
================================================
MIT License

Copyright (c) Roberto Butti

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

================================================
FILE: README.md
================================================
# LaraLens


![CI/CD Github Actions](https://img.shields.io/github/actions/workflow/status/hi-folks/lara-lens/php-code-quality.yml?style=for-the-badge)
![GitHub last commit](https://img.shields.io/github/last-commit/hi-folks/lara-lens?style=for-the-badge)
![GitHub Release Date](https://img.shields.io/github/release-date/hi-folks/lara-lens?style=for-the-badge)
![Packagist PHP Version](https://img.shields.io/packagist/v/hi-folks/lara-lens?style=for-the-badge)


![LaraLens](https://raw.githubusercontent.com/Hi-Folks/lara-lens/develop/LaraLens-Laravel-Artisan.png)

## What
**LaraLens** is a _Laravel_ artisan command to show you the current configuration of your
application. It is useful to show in your terminal the status of:
* some useful configuration variable;
* the database connection;
* the tables in the database;
* the connection via HTTP request;
* the server requirements (PHP version, PHP modules required and installed, Laravel version etc.).

![LaraLens - diagnostic package for Laravel](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ryagpu0qqwgy476x5w5b.gif)


## Why
When 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.
I tried to show more information in just one command.
This 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?".

## Installation

You can install the package via composer:

```shell script
composer require hi-folks/lara-lens
```

The Packagist page is:
https://packagist.org/packages/hi-folks/lara-lens

## Usage

```shell script
php artisan laralens:diagnostic
```

### Usage: control database connection
You can see Database Connection information, and you can choose the table to check, and the column used for the "order by" (default created_at):
```shell script
php artisan laralens:diagnostic --table=migrations --column-sort=id
```
To take the last **created** user:
```shell script
php artisan laralens:diagnostic --table=users --column-sort=created_at
```
To take the last **updated** user:
```shell script
php artisan laralens:diagnostic --table=users --column-sort=updated_at
```

### Usage: control the output
You can control the output via the _show_ option. You can define:

* config
* connection
* database
* runtime
* migration
* php-ext
* php-ini
* all

The default for _--show_ option (if you avoid specifying _--show_) is to display: config, connection, database, runtime, migration.


```shell script
php artisan laralens:diagnostic --show=config --show=connection --show=database --show=runtime --show=migration
```

If you want to see only database information:

```shell script
php artisan laralens:diagnostic --show=database
```

If you want to see a verbose output (with also PHP extensions and PHP INI values):

```shell script
php artisan laralens:diagnostic --show=all
```
or better:
```shell script
php artisan laralens:diagnostic --all
```


If you want to see only PHP extensions:
```shell script
php artisan laralens:diagnostic --show=php-ext
```

If you want to see only PHP INI values:
```shell script
php artisan laralens:diagnostic --show=php-ini
```

### Usage: skip database connection and database diagnostics
If your Laravel application doesn't use the database, you can skip the database inspection with --skip-database option.

```shell script
php artisan laralens:diagnostic --skip-database
```

### Usage: show some oprating system information
You can show some operating system information like:
- PHP script owner's UID
- Current User
- Operating System
- Hostname
- Release name
- Machine Name
- Version info

using _"--show os"_ option or _"--show all"_ option
```shell
php artisan laralens:diagnostic  --show os
```

### Usage: change the style of output table
You can choose one of these styles via *--style=* option:

* default
* borderless
* compact
* symfony-style-guide
* box
* box-double

For example:
```sh
php artisan laralens:diagnostic --style=borderless
```

### Usage: change the width of the output table
To use 120 characters (wide terminal), you can use --large option
```sh
php artisan laralens:diagnostic --large
```


### Testing

``` bash
composer test
```

### Changelog

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

## Usage as Web Page

LaraLens provides information with the command line via terminal as shown above.
You have also the opportunity to see the information via your web browser.
You can enable web view via the configuration.

Publish default configuration for LaraLens in your Laravel Application:
```shell script
php artisan vendor:publish --provider="HiFolks\LaraLens\LaraLensServiceProvider" --tag="config"
```

After that,you will have a new configuration file in your config directory. The file is: config/lara-lens.php

Add `LARALENS_WEB_ENABLED=on` option to your .env file. You may also override the default parameters for `LARALENS_PREFIX` and `LARALENS_MIDDLEWARE`
```
# Wether Web Report should be enabled or not
LARALENS_WEB_ENABLED=on
# Path prefix in order to acess the Web Report via browser
LARALENS_PREFIX="laralens"
# Which middleware should be used when acessing the Web Report, separete more with ;
LARALENS_MIDDLEWARE="web;auth.basic"
```

For 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

```php
return [
    'prefix' => env('LARALENS_PREFIX', 'laralens'), // URL prefix (default=laralens)
    'middleware' => explode(';', env('LARALENS_MIDDLEWARE', 'web')), // middleware (default=web) more separate with ;
    'web-enabled' => env('LARALENS_WEB_ENABLED', 'off') // Activate web view (default=off)
];
```

### Web view configuration hint
LaraLens shows some internal configuration of your Laravel application, so I suggest you to disable it in a production environment.
To disable LaraLens web view, make sure to remove LARALENS_WEB_ENABLED config from .env file or set it to _off_
```
LARALENS_WEB_ENABLED=off
```




## Contributing

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

### Submit ideas or feature requests or issues

* 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)
* 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)


## Credits

- [Roberto Butti](https://github.com/hi-folks)
- [All Contributors](https://github.com/Hi-Folks/lara-lens/graphs/contributors)
- [Laravel Package Boilerplate](https://laravelpackageboilerplate.com)

## Who talks about LaraLens
- [Laravel News](https://laravel-news.com/inspect-application-configuration-with-laralens)
- [Medium Article](https://levelup.gitconnected.com/laralens-a-laravel-command-for-inspecting-configuration-2bbb4e714cf7)

## License

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.


================================================
FILE: composer.json
================================================
{
    "name": "hi-folks/lara-lens",
    "description": "Laravel Diagnostic command for configuration, db connection, http request",
    "keywords": [
        "laravel",
        "diagnostic",
        "cli",
        "package",
        "command-line",
        "console",
        "hi-folks",
        "lara-lens"
    ],
    "homepage": "https://github.com/hi-folks/lara-lens",
    "license": "MIT",
    "type": "library",
    "authors": [
        {
            "name": "Roberto Butti",
            "role": "Developer"
        }
    ],
    "require": {
        "php": "^8.0|^8.1|^8.2|^8.3|^8.4",
        "ext-json": "*",
        "guzzlehttp/guzzle": "^7.8",
        "nunomaduro/termwind": "^1.15|^2.0"
    },
    "require-dev": {
        "doctrine/dbal": "^3.0|^4.0",
        "larastan/larastan": "^2.0",
        "laravel/pint": "^1.4",
        "orchestra/testbench": "^7.0|^8.0|^9.0",
        "pestphp/pest": "^2.34",
        "pestphp/pest-plugin-laravel": "^1.2|^2.3",
        "phpunit/phpunit": "^10.5",
        "rector/rector": "^0.14|^1.0"
    },
    "autoload": {
        "psr-4": {
            "HiFolks\\LaraLens\\": "src"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "HiFolks\\LaraLens\\Tests\\": "tests"
        }
    },
    "scripts": {
        "all": [
            "@style-fix",
            "@phpstan",
            "@test"
        ],
        "style-fix": "pint",
        "style-check": "pint --test",
        "phpstan": "phpstan analyse -c ./phpstan.neon --no-progress",
        "test": "./vendor/bin/pest --order-by random",
        "rector": "rector process --dry-run"
    },
    "scripts-descriptions": {
        "test": "Run all tests, via PespPHP",
        "style-fix": "Fix the code style with PSR12",
        "style-check": "Check the code style with PSR12",
        "phpstan": "Run static code analysis via PHPStan",
        "rector": "Suggest refactoring to be more PHP 8 compliant",
        "all": "Execute tasks for fixing code style, static code analysis and tests"
    },
    "config": {
        "sort-packages": true,
        "allow-plugins": {
            "composer/package-versions-deprecated": false,
            "pestphp/pest-plugin": true
        }
    },
    "extra": {
        "laravel": {
            "providers": [
                "HiFolks\\LaraLens\\LaraLensServiceProvider"
            ],
            "aliases": {
                "LaraLens": "HiFolks\\LaraLens\\LaraLensFacade"
            }
        }
    }
}


================================================
FILE: config/config.php
================================================
<?php

/*
 * LaraLens Configuration.
 */
return [
    'prefix' => env('LARALENS_PREFIX', 'laralens'), // URL prefix (default=laralens)
    'middleware' => explode(';', env('LARALENS_MIDDLEWARE', 'web')), // middleware (default=web) more separate with ;
    'web-enabled' => env('LARALENS_WEB_ENABLED', 'off') // Activate web view (default=off)
];


================================================
FILE: phpcs.xml
================================================
<?xml version="1.0"?>
<ruleset  name="PHP_CodeSniffer">
    <description>PHPCS configuration file.</description>
    <file>src</file>
    <exclude-pattern>*/exclude/*</exclude-pattern>
    <!-- ignore warnings and display ERRORS only -->
    <arg  value="np"/>
    <rule  ref="PSR12"/>
</ruleset>


================================================
FILE: phpstan.neon
================================================
includes:
    - ./vendor/larastan/larastan/extension.neon
parameters:
    reportUnmatchedIgnoredErrors: false
    ignoreErrors:
        - '#Parameter .1 \$separator of function explode expects non-empty-string, string given.#'

    level: 5
    paths:
        - src


================================================
FILE: phpunit.xml.dist
================================================
<?xml version="1.0" encoding="UTF-8"?>
<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">
  <coverage>
    <report>
      <clover outputFile="build/logs/clover.xml"/>
      <html outputDirectory="build/coverage"/>
      <text outputFile="build/coverage.txt"/>
    </report>
  </coverage>
  <testsuites>
    <testsuite name="Test Suite">
      <directory>tests</directory>
    </testsuite>
  </testsuites>
  <logging>
    <junit outputFile="build/report.junit.xml"/>
  </logging>
  <php>
    <env name="DB_CONNECTION" value="testing"/>
  </php>
  <source>
    <include>
      <directory suffix=".php">src/</directory>
    </include>
  </source>
</phpunit>


================================================
FILE: phpunit.xml.dist.bak
================================================
<?xml version="1.0" encoding="UTF-8"?>
<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">
  <coverage>
    <include>
      <directory suffix=".php">src/</directory>
    </include>
    <report>
      <clover outputFile="build/logs/clover.xml"/>
      <html outputDirectory="build/coverage"/>
      <text outputFile="build/coverage.txt"/>
    </report>
  </coverage>
  <testsuites>
    <testsuite name="Test Suite">
      <directory>tests</directory>
    </testsuite>
  </testsuites>
  <logging>
    <junit outputFile="build/report.junit.xml"/>
  </logging>
  <php>
    <env name="DB_CONNECTION" value="testing"/>
  </php>
</phpunit>


================================================
FILE: pint.json
================================================
{
    "preset": "psr12"
}


================================================
FILE: psalm.xml
================================================
<?xml version="1.0"?>
<psalm
    errorLevel="4"
    resolveFromConfigFile="true"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="https://getpsalm.org/schema/config"
    xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
>
    <projectFiles>
        <directory name="src"/>
        <ignoreFiles>
            <directory name="vendor"/>
        </ignoreFiles>
    </projectFiles>
<plugins><pluginClass class="Psalm\LaravelPlugin\Plugin"/></plugins></psalm>


================================================
FILE: rector.php
================================================
<?php

declare(strict_types=1);

use Rector\CodeQuality\Rector\Class_\InlineConstructorDefaultToPropertyRector;
use Rector\Config\RectorConfig;
use Rector\Set\ValueObject\LevelSetList;

return static function (RectorConfig $rectorConfig): void {
    $rectorConfig->paths([
        __DIR__ . '/src'
    ]);

    // register a single rule
    // $rectorConfig->rule(InlineConstructorDefaultToPropertyRector::class);

    // define sets of rules
    $rectorConfig->sets([
        LevelSetList::UP_TO_PHP_80
    ]);
};


================================================
FILE: resources/views/laralens/index.blade.php
================================================
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <meta name="theme-color" content="#000000" />
    <link href="https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css" rel="stylesheet">
    <title>LaraLens</title>
</head>
<body>


<nav class="relative flex flex-wrap items-center justify-between px-2 py-3 navbar-expand-lg bg-yellow-500 mb-3">
    <div class="container px-4 mx-auto flex flex-wrap items-center justify-between">
        <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">

            LaraLens

        </div>
        <div class="lg:flex flex-grow items-center" id="example-navbar-warning">
            <ul class="flex flex-col lg:flex-row list-none ml-auto">
                <li class="nav-item">
                    <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">
                        Tutorial
                    </a>
                </li>
                <li class="nav-item">
                    <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">
                        Packagist
                    </a>
                </li>
                <li class="nav-item">
                    <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">
                        GitHub
                    </a>
                </li>
            </ul>
        </div>
    </div>
</nav>

@foreach( $data as $item)
<div class="bg-white shadow overflow-hidden sm:rounded-lg">
    <div class="px-4 py-5 border-b border-gray-200 sm:px-6">
        <h3 class="text-lg leading-6 font-medium text-gray-900">
            {{$item['title']}}
        </h3>
        <p class="mt-1 max-w-2xl text-sm leading-5 text-gray-500">
            {{$item['description']}}
        </p>
    </div>
    <div>
        <dl class="divide-y divide-gray-400">
            @foreach( $item['data'] as $line)
            <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">
                <dt class="text-sm leading-5 font-medium text-gray-700">
                    {{ $line['label'] }}
                </dt>
                <dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
                    {{ $line['value'] }}

                </dd>
            </div>
            @endforeach
        </dl>
    </div>
</div>
@endforeach

@foreach( $checks as $item)
    @if(\Illuminate\Support\Arr::get($item, "lineType", \HiFolks\LaraLens\ResultLens::LINE_TYPE_DEFAULT) === \HiFolks\LaraLens\ResultLens::LINE_TYPE_HINT)
        <div class="bg-blue-100 border-l-4 border-blue-500 text-blue-700 p-4" role="alert">
            <p class="font-bold">{{ $item['label'] }}</p>
            <p>{{ $item['value']  }}</p>
        </div>

    @elseif(\Illuminate\Support\Arr::get($item, "lineType", \HiFolks\LaraLens\ResultLens::LINE_TYPE_DEFAULT) === \HiFolks\LaraLens\ResultLens::LINE_TYPE_ERROR)
        <div class="bg-red-100 border-l-4 border-red-500 text-red-700 p-4" role="alert">
            <p class="font-bold">{{ $item['label'] }}</p>
            <p>{{ $item['value']  }}</p>
        </div>
    @elseif(\Illuminate\Support\Arr::get($item, "lineType", \HiFolks\LaraLens\ResultLens::LINE_TYPE_DEFAULT) === \HiFolks\LaraLens\ResultLens::LINE_TYPE_WARNING)
        <div class="bg-orange-100 border-l-4 border-orange-500 text-orange-700 p-4" role="alert">
            <p class="font-bold">{{ $item['label'] }}</p>
            <p>{{ $item['value']  }}</p>
        </div>
    @else
        <div class="bg-grey-100 border-l-4 border-grey-500 text-grey-700 p-4" role="alert">
            <p class="font-bold">{{ $item['label'] }}</p>
            <p>{{ $item['value']  }}</p>
        </div>

    @endif

@endforeach

</body>
</html>


================================================
FILE: resources/views/laralens/term/checks.blade.php
================================================
<div class="mt-2 mx-1">
    @if (sizeof($rows) > 0)
        <div class="flex space-x-1">
            <span class="text-red">CHECK: issues found</span>
            <span class="flex-1 content-repeat-[─] text-red"></span>
        </div>
    @else
        <div class="flex space-x-1">
            <span class="text-green">CHECK: everything looks good</span>
            <span class="flex-1 content-repeat-[─] text-green"></span>
        </div>
    @endif
    <div>
        @foreach ($rows as $row)
            @php
                $lineType = Arr::get($row, "lineType", HiFolks\LaraLens\ResultLens::LINE_TYPE_DEFAULT);
                $label = Arr::get($row, "label", "");
            @endphp
            @if ($label === "*** HINT")
                <div class="flex space-x-1 mt-1">
                    <span class="px-1 text-gray-100">💡 Hint:</span>
                    <span>
                        <span class="px-0  text-gray-300">
                            {{ Arr::get($row, "value", "") }}
                        </span>
                    </span>
                </div>
            @else
                <div @class([
                        'w-full mx-1 py-1 mt-1 text-center font-bold',
                        'bg-red text-white' => $lineType === HiFolks\LaraLens\ResultLens::LINE_TYPE_ERROR,
                        'bg-yellow text-black' => $lineType === HiFolks\LaraLens\ResultLens::LINE_TYPE_WARNING,
                        'bg-green text-white' => $lineType !== HiFolks\LaraLens\ResultLens::LINE_TYPE_ERROR
                            && $lineType !== HiFolks\LaraLens\ResultLens::LINE_TYPE_WARNING,
                ])>
                    {{ Arr::get($row, "label", "")}}
                </div>
                <div class="mt-1 mx-1 text-gray-300">
                    @if ($lineType === HiFolks\LaraLens\ResultLens::LINE_TYPE_ERROR)
                        {{ Arr::get($row, "value", "")}}
                    @elseif ($lineType === HiFolks\LaraLens\ResultLens::LINE_TYPE_WARNING)
                        {{ Arr::get($row, "value", "")}}
                    @else
                        {{ Str::replace("\\", "/", Arr::get($row, "value", "")) }}
                    @endif
                </div>
            @endif
        @endforeach
    </div>
</div>


================================================
FILE: resources/views/laralens/term/table.blade.php
================================================
<div class="mt-1.5 mx-1">
    <div class="flex space-x-1">
        <span class="text-green">{{ $title }}</span>
        <span class="flex-1 content-repeat-[─] text-gray"></span>
    </div>
    <div class="mt-1">
        <span>
            @foreach ($rows as $row)
                @php
                    $lineType = Arr::get($row, "lineType", HiFolks\LaraLens\ResultLens::LINE_TYPE_DEFAULT);
                    $label = Arr::get($row, "label", "");
                @endphp
                @if ($label === "*** HINT")
                    <div class="flex space-x-1">
                    <span class=" text-white  font-bold">Hint:</span>
                    <span class="flex-1  content-repeat-[.] text-gray"></span>
                    <div>
                        <span class="px-2 text-gray font-bold">
                            {{ Arr::get($row, "value", "") }}
                        </span>
                    </div>
                </div>
                @else
                    <div class="flex space-x-1">
                    <span class=" text-white  font-bold">
                        {{ Arr::get($row, "label", "")}}
                    </span>

                    <span class="flex-1  content-repeat-[.] text-gray"></span>

                    <span>
                        @if ($lineType === HiFolks\LaraLens\ResultLens::LINE_TYPE_ERROR)
                            <span class="text-gray-100 bg-red  font-bold">
                                {{ Arr::get($row, "value", "")}}
                            </span>
                        @elseif ($lineType === HiFolks\LaraLens\ResultLens::LINE_TYPE_WARNING)
                            <span class="text-gray-100 bg-yellow  font-bold">
                                {{ Arr::get($row, "value", "")}}
                            </span>
                        @else
                            <span class="text-gray-100">
                                {{ Str::replace("\\", "/", Arr::get($row, "value", "")) }}
                            </span>
                        @endif
                    </span>
                </div>
                @endif
            @endforeach
        </span>
    </div>

</div>


================================================
FILE: routes/web.php
================================================
<?php

use Illuminate\Support\Facades\Route;
use HiFolks\LaraLens\Http\Controllers\LaraLensController;

Route::get('/', [LaraLensController::class, 'index'])->name('laralens.index');


================================================
FILE: src/Console/LaraLensCommand.php
================================================
<?php

namespace HiFolks\LaraLens\Console;

use HiFolks\LaraLens\Lens\LaraLens;
use HiFolks\LaraLens\Lens\Traits\TermOutput;
use HiFolks\LaraLens\ResultLens;
use Illuminate\Console\Command;

class LaraLensCommand extends Command
{
    use TermOutput;

    private const TABLE_STYLES = 'default|borderless|compact|symfony-style-guide|box|box-double';
    private const DEFAULT_STYLE = 'box-double';
    private const DEFAULT_PATH = '';
    protected $styleTable = self::DEFAULT_STYLE;
    protected $signature = 'laralens:diagnostic
                            {op=overview : What you want to see, overview or allconfigs (overview|allconfigs)}
                            {--table=users : name of the table, default users}
                            {--column-sort=created_at : column name used for sorting}
                            {--url-path=' . self::DEFAULT_PATH . ' : default path for checking URL}
                            {--show=* : show (all|config|runtime|connection|database|migration|php-ext|php-ini|os)}
                            {--width-label=' . self::DEFAULT_WIDTH . ' : width of column for label}
                            {--width-value=' . self::DEFAULT_WIDTH . ' : width of column for value}
                            {--large : use 120 columns for the output}
                            {--style=' . self::DEFAULT_STYLE . ' : style for output table (' . self::TABLE_STYLES . ')}
                            {--skip-database : skip database check (if your laravel app doesn\'t need Database)}
                            {--a|all : verbose output (--show=all)}
                            ';

    protected $description = 'Show some application configurations.';

    private const DEFAULT_WIDTH = 36;
    private const DEFAULT_LARGE_WIDTH = 77;
    protected $widthLabel = self::DEFAULT_WIDTH;
    protected $widthValue = self::DEFAULT_WIDTH;

    protected $urlPath = self::DEFAULT_PATH;

    public const OPTION_SHOW_NONE = 0b0000000;
    public const OPTION_SHOW_CONFIGS = 0b0000001;
    public const OPTION_SHOW_RUNTIMECONFIGS = 0b00000010;
    public const OPTION_SHOW_CONNECTIONS = 0b00000100;
    public const OPTION_SHOW_DATABASE = 0b00001000;
    public const OPTION_SHOW_MIGRATION = 0b00010000;
    public const OPTION_SHOW_PHPEXTENSIONS = 0b00100000;
    public const OPTION_SHOW_PHPINIVALUES = 0b01000000;
    public const OPTION_SHOW_OS = 0b10000000;
    public const OPTION_SHOW_ALL = 0b11111111;
    public const OPTION_SHOW_DEFAULT = 0b00011111;

    private function allConfigs(): void
    {
        $this->info(json_encode(config()->all(), JSON_PRETTY_PRINT));
    }

    private function overview($checkTable = "users", $columnSorting = "created_at", $show = self::OPTION_SHOW_ALL): void
    {
        $ll = new LaraLens();
        if ($show & self::OPTION_SHOW_CONFIGS) {
            $output = $ll->getConfigs();
            $this->printOutputTerm("Config keys via config()", $output->toArray());
        }
        if ($show & self::OPTION_SHOW_RUNTIMECONFIGS) {
            $output = $ll->getRuntimeConfigs();
            $this->printOutputTerm("Runtime Configs", $output->toArray());
            $output = $ll->checkServerRequirements();
            $this->printOutputTerm("Laravel Requirements", $output->toArray());
        }
        if ($show & self::OPTION_SHOW_RUNTIMECONFIGS) {
            $output = $ll->checkFiles();
            $this->printOutputTerm("Check files", $output->toArray());
        }
        if ($show & self::OPTION_SHOW_CONNECTIONS) {
            $output = $ll->getConnections($this->urlPath);
            $this->printOutputTerm("Connections", $output->toArray());
        }
        if ($show & self::OPTION_SHOW_DATABASE) {
            $output = $ll->getDatabase($checkTable, $columnSorting);
            $this->printOutputTerm("Database", $output->toArray());
        }
        if ($show & self::OPTION_SHOW_MIGRATION) {
            try {
                $this->call('migrate:status');
            } catch (\Exception $e) {
                $r = new ResultLens();
                $r->add(
                    "Check migrate status",
                    "Error in check migration"
                );
                $ll->checksBag->addErrorAndHint(
                    "Migration status",
                    $e->getMessage(),
                    "Check the Database configuration"
                );
                $this->printOutputTerm("Migration", $r->toArray());
            }
        }
        if ($show & self::OPTION_SHOW_PHPEXTENSIONS) {
            $output = $ll->getPhpExtensions();
            $this->printOutputTerm("PHP Extensions", $output->toArray());
        }
        if ($show & self::OPTION_SHOW_PHPINIVALUES) {
            $output = $ll->getPhpIniValues();
            $this->printOutputTerm("PHP ini config", $output->toArray());
        }
        if ($show & self::OPTION_SHOW_OS) {
            $output = $ll->getOsConfigs();
            $this->printOutputTerm("Operating System", $output->toArray());
        }
        $this->printChecksTerm($ll->checksBag->toArray());
    }


    public function handle(): void
    {
        $op = $this->argument("op");
        $checkTable = $this->option("table");
        $styleTable = $this->option("style");
        $show = self::OPTION_SHOW_DEFAULT;
        if (in_array($styleTable, explode("|", self::TABLE_STYLES))) {
            $this->styleTable = $styleTable;
        } else {
            $this->styleTable = self::DEFAULT_STYLE;
        }
        $columnSorting = $this->option("column-sort");
        $showOptions = $this->option("all") ? ['all'] : $this->option("show");


        if (is_array($showOptions)) {
            if (count($showOptions) > 0) {
                $show = self::OPTION_SHOW_NONE;
                if (in_array("all", $showOptions)) {
                    $show = self::OPTION_SHOW_ALL;
                } else {
                    $show = (in_array("config", $showOptions)) ? $show | self::OPTION_SHOW_CONFIGS : $show ;
                    $show = (in_array("runtime", $showOptions)) ? $show | self::OPTION_SHOW_RUNTIMECONFIGS : $show ;
                    $show = (in_array("connection", $showOptions)) ? $show | self::OPTION_SHOW_CONNECTIONS : $show ;
                    $show = (in_array("database", $showOptions)) ? $show | self::OPTION_SHOW_DATABASE : $show ;
                    $show = (in_array("migration", $showOptions)) ? $show | self::OPTION_SHOW_MIGRATION : $show ;
                    $show = (in_array("php-ext", $showOptions)) ? $show | self::OPTION_SHOW_PHPEXTENSIONS : $show ;
                    $show = (in_array("php-ini", $showOptions)) ? $show | self::OPTION_SHOW_PHPINIVALUES : $show ;
                    $show = (in_array("os", $showOptions)) ? $show | self::OPTION_SHOW_OS : $show ;
                }
            } else {
                $show = self::OPTION_SHOW_DEFAULT;
            }
        }
        $skipDatabases = $this->option("skip-database");
        if ($skipDatabases) {
            $show = $show - self::OPTION_SHOW_DATABASE - self::OPTION_SHOW_MIGRATION;
        }

        $this->widthLabel = $this->option("width-label");
        $this->widthValue = $this->option("width-value");
        if ($this->option("large")) {
            $this->widthValue = self::DEFAULT_LARGE_WIDTH;
        }

        $this->urlPath = $this->option("url-path");
        if (is_null($this->urlPath)) {
            $this->urlPath = self::DEFAULT_PATH;
        }
        $version = \Composer\InstalledVersions::getPrettyVersion('hi-folks/lara-lens');
        $this->title("Laralens (" . $version . ")");
        match ($op) {
            'overview' => $this->overview($checkTable, $columnSorting, $show),
            'allconfigs' => $this->allConfigs(),
            default => $this->info("What you mean? try with 'php artisan laralens:diagnostic --help'"),
        };
    }
}


================================================
FILE: src/Http/Controllers/Controller.php
================================================
<?php

namespace HiFolks\LaraLens\Http\Controllers;

use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;

class Controller extends BaseController
{
    use AuthorizesRequests;
    use DispatchesJobs;
    use ValidatesRequests;
}


================================================
FILE: src/Http/Controllers/LaraLensController.php
================================================
<?php

namespace HiFolks\LaraLens\Http\Controllers;

use HiFolks\LaraLens\Lens\LaraLens;

class LaraLensController extends Controller
{
    public function index(): \Illuminate\View\View
    {
        if (config('lara-lens.web-enabled') != 'on') {
            abort(403, 'Unauthorized action.', ['X-Laralens' => 'off']);
        }
        $ll = new LaraLens();



        $data = [
            [
                "title" => "Check Server requirements",
                "description" => "Check Server requirements",
                "data" => $ll->checkServerRequirements()->toArray()
            ],
            [
                "title" => "Configs",
                "description" => "Config keys via config()",
                "data" => $ll->getConfigs()->toArray()
            ],
            [
                "title" => "Runtime",
                "description" => "Laravel Runtime configs",
                "data" => $ll->getRuntimeConfigs()->toArray()
            ],
            [
                "title" => "Check files",
                "description" => "Check files consistency / exists",
                "data" => $ll->checkFiles()->toArray()
            ],
            [
                "title" => "Connections",
                "description" => "Check connections",
                "data" => $ll->getConnections('')->toArray()
            ],
            [
                "title" => "Database",
                "description" => "Config Database",
                "data" => $ll->getDatabase()->toArray()
            ],
            [
                "title" => "PHP Extensions",
                "description" => "List of PHP extensions loaded",
                "data" => $ll->getPhpExtensions()->toArray()
            ],
            [
                "title" => "PHP INI",
                "description" => "List of php ini values",
                "data" => $ll->getPhpIniValues()->toArray()
            ],
            [
                "title" => "Credits",
                "description" => "LaraLens app",
                "data" => $ll->getCredits()->toArray()
            ],
        ];

        $checks = $ll->checksBag->toArray();

        return view('lara-lens::laralens.index', ['data' => $data, 'checks' => $checks]);
    }
}


================================================
FILE: src/LaraLensFacade.php
================================================
<?php

namespace HiFolks\LaraLens;

use Illuminate\Support\Facades\Facade;

class LaraLensFacade extends Facade
{
    /**
     * Get the registered name of the component.
     *
     * @return string
     */
    protected static function getFacadeAccessor()
    {
        return 'lara-lens';
    }
}


================================================
FILE: src/LaraLensServiceProvider.php
================================================
<?php

namespace HiFolks\LaraLens;

use HiFolks\LaraLens\Console\LaraLensCommand;
use Illuminate\Support\ServiceProvider;
use HiFolks\LaraLens\Lens\LaraLens;
use Illuminate\Support\Facades\Route;

class LaraLensServiceProvider extends ServiceProvider
{
    /**
     * Bootstrap the application services.
     */
    public function boot(): void
    {
        /*
         * Optional methods to load your package assets
         */
        // $this->loadTranslationsFrom(__DIR__.'/../resources/lang', 'lara-lens');
        $this->loadViewsFrom(__DIR__ . '/../resources/views', 'lara-lens');
        // $this->loadMigrationsFrom(__DIR__.'/../database/migrations');
        //$this->loadRoutesFrom(__DIR__.'/routes.php');
        $this->registerRoutes();

        if ($this->app->runningInConsole()) {
            $this->publishes(
                [
                __DIR__ . '/../config/config.php' => config_path('lara-lens.php'),
                ],
                'config'
            );

            // Publishing the views.
            /*$this->publishes([
                __DIR__.'/../resources/views' => resource_path('views/vendor/lara-lens'),
            ], 'views');*/

            // Publishing assets.
            /*$this->publishes([
                __DIR__.'/../resources/assets' => public_path('vendor/lara-lens'),
            ], 'assets');*/

            // Publishing the translation files.
            /*$this->publishes([
                __DIR__.'/../resources/lang' => resource_path('lang/vendor/lara-lens'),
            ], 'lang');*/

            // Registering package commands.
            $this->commands(
                [
                LaraLensCommand::class,
                ]
            );
        }
    }


    protected function registerRoutes(): void
    {
        Route::group($this->routeConfiguration(), function () {
            $this->loadRoutesFrom(__DIR__ . '/../routes/web.php');
        });
    }

    /**
     * @return (\Illuminate\Config\Repository|mixed)[]
     *
     * @psalm-return array{prefix: \Illuminate\Config\Repository|mixed, middleware: \Illuminate\Config\Repository|mixed}
     */
    protected function routeConfiguration(): array
    {
        return [
            'prefix' => config('lara-lens.prefix', 'laralens-diagnostic'),
            'middleware' => config('lara-lens.middleware'),
        ];
    }

    /**
     * Register the application services.
     */
    public function register()
    {
        // Automatically apply the package configuration
        $this->mergeConfigFrom(__DIR__ . '/../config/config.php', 'lara-lens');

        // Register the main class to use with the facade
        $this->app->singleton(
            'lara-lens',
            fn () => new LaraLens()
        );
    }
}


================================================
FILE: src/Lens/LaraHttp.php
================================================
<?php

namespace HiFolks\LaraLens\Lens;

use GuzzleHttp\Client;
use GuzzleHttp\Exception\GuzzleException;
use HiFolks\LaraLens\Lens\Objects\LaraHttpResponse;

class LaraHttp
{
    public static function get($url): LaraHttpResponse
    {
        $client = new Client();
        try {
            $response = new LaraHttpResponse($client->get($url, ['timeout' => 1]));
        } catch (GuzzleException $e) {
            $response = null;
            throw $e;
        }
        return $response;
    }
}


================================================
FILE: src/Lens/LaraLens.php
================================================
<?php

namespace HiFolks\LaraLens\Lens;

use HiFolks\LaraLens\Lens\Traits\ConfigLens;
use HiFolks\LaraLens\Lens\Traits\DatabaseLens;
use HiFolks\LaraLens\Lens\Traits\FilesystemLens;
use HiFolks\LaraLens\Lens\Traits\HttpConnectionLens;
use HiFolks\LaraLens\Lens\Traits\OperatingSystemLens;
use HiFolks\LaraLens\Lens\Traits\RuntimeLens;
use HiFolks\LaraLens\ResultLens;

class LaraLens
{
    use DatabaseLens;
    use ConfigLens;
    use HttpConnectionLens;
    use RuntimeLens;
    use FilesystemLens;
    use OperatingSystemLens;

    /**
     * @var ResultLens
     */
    public $checksBag;

    public function __construct()
    {
        $this->checksBag = new ResultLens();
    }

    /**
     * @return ResultLens
     */
    public function getCredits()
    {
        $results = new ResultLens();
        $results->add(
            "App",
            "powered by LaraLens"
        );


        return $results;
    }


    /**
     * @return string
     */
    public static function printBool(bool $b)
    {
        return $b ? "Yes" : "No";
    }
}


================================================
FILE: src/Lens/Objects/LaraHttpResponse.php
================================================
<?php

namespace HiFolks\LaraLens\Lens\Objects;

use Psr\Http\Message\ResponseInterface;

class LaraHttpResponse
{
    /**
     * LaraHttpResponse constructor.
     */
    public function __construct(private ResponseInterface $response)
    {
    }

    /**
     * Return the Http response status code.
     *
     * @return int
     */
    public function status()
    {
        return $this->response->getStatusCode();
    }

    /**
     * Return true if the status code of the HTTP response is an error
     *
     * @return bool
     */
    public function failed()
    {
        return ($this->response->getStatusCode() >= 400);
    }
}


================================================
FILE: src/Lens/Traits/BaseTraits.php
================================================
<?php

namespace HiFolks\LaraLens\Lens\Traits;

use Illuminate\Support\Str;

trait BaseTraits
{
    protected function stripPrefixDir($value)
    {
        //$curDir = getcwd();
        $curDir = base_path();
        if (Str::length($curDir) > 3) {
            if (Str::startsWith($value, $curDir)) {
                $value = "." . Str::after($value, $curDir);
            }
        }
        return $value;
    }
}


================================================
FILE: src/Lens/Traits/ConfigLens.php
================================================
<?php

namespace HiFolks\LaraLens\Lens\Traits;

use HiFolks\LaraLens\ResultLens;

trait ConfigLens
{
    public function getConfigsDatabaseFromEnv(ResultLens|null $results = null): \HiFolks\LaraLens\ResultLens
    {
        if (is_null($results)) {
            $results = new ResultLens();
        }
        $configKeys = [
            "DB_HOST",
            "DB_DATABASE",
            "DB_USERNAME",
            "DB_CONNECTION",
            "DB_PORT"
        ];
        foreach ($configKeys as $key => $value) {
            $results->add(
                ".env " . $value,
                env($value)
            );
        }
        return $results;
    }

    public function checkDebugEnv(ResultLens|null $results = null): \HiFolks\LaraLens\ResultLens
    {
        if (is_null($results)) {
            $results  = new ResultLens();
        }
        $debug = config("app.debug");
        $env = config("app.env");
        $results->add(
            "ENV",
            $env
        );
        $results->add(
            "DEBUG",
            $debug
        );
        if ($debug && $env === "production") {
            $this->checksBag->addWarningAndHint(
                "Check config ENV and DEBUG",
                "You have DEBUG mode in Production.",
                "Change you APP_DEBUG env parameter to false for Production environments"
            );
        }
        return $results;
    }

    public function getConfigsDatabase(ResultLens|null $results = null): \HiFolks\LaraLens\ResultLens
    {
        if (is_null($results)) {
            $results = new ResultLens();
        }
        $configKeys = [
            "database.default",
            "database.connections." . config("database.default") . ".driver",
            "database.connections." . config("database.default") . ".url",
            "database.connections." . config("database.default") . ".host",
            "database.connections." . config("database.default") . ".port",
            "database.connections." . config("database.default") . ".username",
            "database.connections." . config("database.default") . ".database"
        ];
        foreach ($configKeys as $key => $value) {
            $results->add(
                "" . $value,
                config($value)
            );
        }
        return $results;
    }

    public function getConfigs()
    {
        $results = new ResultLens();
        $results->add(
            "Running diagnostic",
            date('Y-m-d H:i:s')
        );
        $configKeys = [
            "app.timezone",
            "app.locale",
            "app.name",
            "app.url",
        ];
        foreach ($configKeys as $key => $value) {
            $results->add(
                "" . $value,
                config($value)
            );
        }
        $results = $this->checkDebugEnv($results);
        $results = $this->getConfigsDatabase($results);
        return $results;
    }
}


================================================
FILE: src/Lens/Traits/DatabaseLens.php
================================================
<?php

namespace HiFolks\LaraLens\Lens\Traits;

use Illuminate\Database\Connection;
use Illuminate\Database\QueryException;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Str;
use HiFolks\LaraLens\ResultLens;

trait DatabaseLens
{
    public function getTablesListMysql(): string
    {
        $tables = DB::select('SHOW TABLES');
        $stringTables = "";
        foreach ($tables as $table) {
            foreach ($table as $key => $value) {
                $stringTables = $stringTables . $value . ";";
            }
        }
        return $stringTables;
    }

    public function getTablesListSqlite(): string
    {
        $tables = DB::table('sqlite_master')
            ->select('name')
            ->where('type', 'table')
            ->orderBy('name')
            ->pluck('name')->toArray();
        $stringTables = implode(",", $tables);
        return $stringTables;
    }

    /**
     * Try to establish a db connection.
     * If it fails, return FALSE and fill checksBag.
     */
    public function dbConnection(): false|\Illuminate\Database\Connection
    {
        $dbconnection = false;
        try {
            $dbconnection = DB::connection();
        } catch (\Exception $e) {
            $dbconnection = false;
            $this->checksBag->addErrorAndHint(
                "Error Database connection",
                "- " . $e->getCode() . " - " . $e->getMessage(),
                "Check out your .env file for these parameters: DB_HOST, DB_DATABASE, DB_USERNAME, DB_PASSWORD"
            );
        }
        return $dbconnection;
    }

    public function getDatabaseConnectionInfos(
        Connection $dbConnection,
        ResultLens $results,
        $checkTable,
        $columnSorting
    ) {
        $connectionName = $dbConnection->getName();
        $results->add(
            "Connection name",
            $connectionName
        );
        $grammar = $dbConnection->getQueryGrammar();
        $results->add(
            "Query Grammar",
            Str::afterLast($grammar::class, '\\')
        );
        $driverName = $dbConnection->getDriverName();
        $results->add(
            "Driver name",
            $driverName
        );
        $databaseName = $dbConnection->getDatabaseName();
        $results->add(
            "Database name",
            $databaseName
        );
        $tablePrefix = $dbConnection->getTablePrefix();
        $results->add(
            "Table prefix",
            $tablePrefix
        );

        $pdo = null;
        $pdoIsOk = false;
        try {
            $pdo = $dbConnection->getPDO();
            $pdoIsOk = true;
        } catch (\PDOException $e) {
            $this->checksBag->addWarningAndHint(
                "Access to PDO (database)",
                $e->getMessage(),
                "Check .env DB_*"
            );
        }

        if (!$pdoIsOk) {
            if ($driverName === "mongodb") {
                $this->checksBag->addInfoAndHint(
                    "Connection and PDO driver",
                    "It is ok! Because you are using " . $driverName . ", and it doesn't support PDO driver.",
                    ""
                );
            } else {
            }
        } else {
            try {
                $serverVersion = $dbConnection->getPDO()->getAttribute(\PDO::ATTR_SERVER_VERSION);
                $results->add(
                    "Server version",
                    $serverVersion
                );
            } catch (\PDOException $e) {
                $results->addErrorAndHint(
                    "Error DB",
                    $e->getMessage(),
                    "Check out your .env file for these parameters: DB_HOST, DB_DATABASE, DB_USERNAME, DB_PASSWORD"
                );
                $results = $this->getConfigsDatabase($results);
                $results = $this->getConfigsDatabaseFromEnv($results);
                return $results;
            }


            $connectionType = $dbConnection->getPDO()->getAttribute(\PDO::ATTR_DRIVER_NAME);
            $results->add(
                "Database connection type",
                $connectionType
            );
            $stringTables = "";
            $stringTables = match ($connectionType) {
                'mysql' => $this->getTablesListMysql(),
                'sqlite' => $this->getTablesListSqlite(),
                default => "<<skipped " . $connectionType . ">>",
            };
            $results->add(
                "Tables",
                $stringTables
            );

            $checkCountMessage = "";
            $checkCount = 0;
            try {
                $checkCount = DB::table($checkTable)
                    ->select(DB::raw('*'))
                    ->count();
            } catch (\Exception) {
                $checkCount = 0;
                $checkCountMessage = " - error with " . $checkTable . " table";
                $results->addErrorAndHint(
                    "Table Error",
                    "Failed query, table <" . $checkTable . "> ",
                    "Make sure that table <" . $checkTable .
                    "> exists, available tables : " .
                    (($stringTables == "") ? "Not tables found" : $stringTables)
                );
            }

            $results->add(
                "Query Table",
                $checkTable
            );
            $results->add(
                "Number of rows",
                $checkCount . $checkCountMessage
            );
            if ($checkCount > 0) {
                try {
                    $latest = DB::table($checkTable)->latest($columnSorting)->first();
                    $results->add(
                        "LAST row in table",
                        json_encode($latest, JSON_THROW_ON_ERROR)
                    );
                } catch (QueryException) {
                    $results->addErrorAndHint(
                        "Table Error",
                        "Failed query, table <" . $checkTable . "> column <" . $columnSorting . ">",
                        "Make sure that table <" . $checkTable . "> column <" . $columnSorting . "> exists"
                    );
                }
            }
        }
    }

    public function getDatabase($checkTable = "users", $columnSorting = "created_at"): \HiFolks\LaraLens\ResultLens
    {
        $results = new ResultLens();

        $dbConnection = $this->dbConnection();


        $results->add(
            "Database default",
            config("database.default")
        );
        if ($dbConnection) {
            $this->getDatabaseConnectionInfos($dbConnection, $results, $checkTable, $columnSorting);
        }





        return $results;
    }
}


================================================
FILE: src/Lens/Traits/FilesystemLens.php
================================================
<?php

namespace HiFolks\LaraLens\Lens\Traits;

use HiFolks\LaraLens\ResultLens;
use Illuminate\Support\Facades\App;

trait FilesystemLens
{
    use BaseTraits;

    protected function links()
    {
        return config("filesystems.links") ??
            [public_path('storage') => storage_path('app/public')];
        //return $this->laravel['config']['filesystems.links'] ??
    }
    public function checkFiles(): \HiFolks\LaraLens\ResultLens
    {
        $results = new ResultLens();
        $envExists = file_exists(App::environmentFilePath());
        if ($envExists) {
            $results->add(
                "Check .env exists",
                self::printBool($envExists)
            );
        } else {
            $results->addWarningAndHint(
                "Check .env exists",
                ".env not exists",
                "Create .env file"
            );
        }
        $results->add(
            "Check Languages directory",
            self::printBool(is_dir(App::langPath()))
        );
        try {
            $langArray = scandir(App::langPath());
        } catch (\Exception) {
            $langArray = false;
        }
        $languages = "";
        if ($langArray) {
            $languages = implode(",", array_diff($langArray, ['..', '.', 'vendor']));
        } else {
            $languages = "No language found";
            $this->checksBag->addWarningAndHint(
                "List Languages directory",
                "No languages found in " . App::langPath(),
                "If your app needs translations, please fill " . App::langPath() . " or run `php artisan lang:publish`"
            );
        }
        $results->add(
            "List Languages directory",
            $languages
        );

        foreach ($this->links() as $link => $dir) {
            if (!file_exists($link)) {
                $this->checksBag->addWarningAndHint(
                    "Check storage link",
                    $this->stripPrefixDir($link) . " it doesn't exist.",
                    "Check config/filesystem.php 'links' parameter, and execute 'php artisan storage:link'"
                );
            }
            if (!file_exists($dir)) {
                $this->checksBag->addWarningAndHint(
                    "Check storage target link",
                    $this->stripPrefixDir($dir) . " it doesn't exist.",
                    "Create directory target (for storage link) : " . $dir
                );
            }

            $results->add(
                "Storage links:",
                ""
            );
            $results->add(
                $this->stripPrefixDir($link),
                $this->stripPrefixDir($dir)
            );
        }

        return $results;
    }
}


================================================
FILE: src/Lens/Traits/HttpConnectionLens.php
================================================
<?php

namespace HiFolks\LaraLens\Lens\Traits;

use HiFolks\LaraLens\Lens\LaraHttp;
use HiFolks\LaraLens\ResultLens;

trait HttpConnectionLens
{
    public function getConnections($checkPath): \HiFolks\LaraLens\ResultLens
    {
        $results = new ResultLens();
        $app_url = config("app.url");
        $results->add(
            "app.url configuration",
            $app_url
        );
        $url = url($checkPath);
        $results->add(
            "url()->full()",
            url()->full()
        );
        $results->add(
            "Connection HTTP URL",
            $url
        );
        try {
            $response = LaraHttp::get($url);
            $results->add(
                "Connection HTTP Status",
                $response->status()
            );
            if ($response->failed()) {
                $checkUrlHint = "Check APP_URL '" . $app_url . "' in .env file ";
                if ($checkPath !== "") {
                    $checkUrlHint .= " or check this path: '" . $checkPath . "' in routing file (routes/web.php)";
                }
                $this->checksBag->addWarningAndHint(
                    "Connection HTTP Status",
                    "Connection response not 20x, status code: " . $response->status() . " for " . $url,
                    $checkUrlHint
                );
            }
        } catch (\Exception $e) {
            $results->add(
                "Connection HTTP Status",
                "Error connection"
            );
            $this->checksBag->addErrorAndHint(
                "Connection HTTP Status",
                "Connection Error: " . $e->getMessage(),
                "Check this URL: " . $app_url . " in .env file APP_URL"
            );
        }
        return $results;
    }
}


================================================
FILE: src/Lens/Traits/OperatingSystemLens.php
================================================
<?php

namespace HiFolks\LaraLens\Lens\Traits;

use HiFolks\LaraLens\ResultLens;

trait OperatingSystemLens
{
    private function getUnameValues($results): void
    {
        $modes =  [
            "s" => "Operating System",
            "n" => "Hostname",
            "r" => "Release name",
            "v" => "Version info",
            "m" => "Machine Name",
            "a" => "Full infos"
        ];

        foreach ($modes as $key => $title) {
            $results->add(
                $title,
                php_uname($key)
            );
        }
    }

    public function getOsConfigs(): \HiFolks\LaraLens\ResultLens
    {
        $results = new ResultLens();
        $results->add(
            "PHP script owner's UID",
            getmyuid()
        );
        $results->add(
            "Current User",
            get_current_user()
        );
        $this->getUnameValues($results);
        return $results;
    }
}


================================================
FILE: src/Lens/Traits/RuntimeLens.php
================================================
<?php

namespace HiFolks\LaraLens\Lens\Traits;

use HiFolks\LaraLens\ResultLens;
use Illuminate\Support\Arr;
use Illuminate\Support\Str;

trait RuntimeLens
{
    private function appCaller($results, $functions): void
    {
        $curDir = getcwd();
        foreach ($functions as $function => $label) {
            $value = call_user_func("App::" . $function);
            if (Str::length($curDir) > 3) {
                if (Str::startsWith($value, $curDir)) {
                    $value = "." . Str::after($value, $curDir);
                }
            }
            $results->add(
                $label,
                $value
            );
        }
    }

    private function getIniValues($results): void
    {
        $labels = [
            "post_max_size",
            "upload_max_filesize",
        ];
        foreach ($labels as $label) {
            $results->add(
                $label,
                ini_get($label)
            );
        }
    }

    public function getRuntimeConfigs(): \HiFolks\LaraLens\ResultLens
    {
        $results = new ResultLens();
        $results->add(
            "PHP Version",
            phpversion()
        );
        $this->getIniValues($results);
        $results->add(
            "Current Directory",
            getcwd()
        );
        $this->appCaller(
            $results,
            [
                "version" => "Laravel Version",
                "getLocale" => "Locale",
                "getNamespace" => "Application namespace",
                "environment" => "Environment",
                "environmentPath" => "Environment file directory",
                "environmentFile" => "Environment file used",
                "environmentFilePath" => "Full path to the environment file",
                "langPath" => "Path to the language files",
                "publicPath" => "Path to the public / web directory",
                "storagePath" => "Storage directory",
                "resourcePath" => "Resources directory",
                "getCachedServicesPath" => "Path to the cached services.php",
                "getCachedPackagesPath" => "Path to the cached packages.php",
                "getCachedConfigPath" => "Path to the configuration cache",
                "getCachedRoutesPath" => "Path to the routes cache",
                "getCachedEventsPath" => "Path to the events cache file"
            ]
        );
        $results->add(
            "Generated url for / ",
            url("/")
        );
        $results->add(
            "Generated asset url for /test.js ",
            asset("/test.js")
        );
        return $results;
    }

    public function checkServerRequirements(): \HiFolks\LaraLens\ResultLens
    {
        $results = new ResultLens();

        $phpVersion = phpversion();
        $laravelVersion = app()->version();
        $laravelMajorVersion = Arr::get(explode('.', $laravelVersion), 0, "8");

        $phpExtensionRequirements = [
            "6" => [
                "phpversion" => "7.2.0",
                "extensions" => [
                    "bcmath",
                    "ctype",
                    "fileinfo",
                    "json",
                    "mbstring",
                    "openssl",
                    "pdo",
                    "tokenizer",
                    "xml"
                ]
            ],
            "7" => [
                "phpversion" => "7.2.5",
                "extensions" => [
                    "bcmath",
                    "ctype",
                    "fileinfo",
                    "json",
                    "mbstring",
                    "openssl",
                    "pdo",
                    "tokenizer",
                    "xml"
                ]
            ],
            "8" => [
                "phpversion" => "7.3.0",
                "extensions" => [
                    "bcmath",
                    "ctype",
                    "fileinfo",
                    "json",
                    "mbstring",
                    "openssl",
                    "pdo",
                    "tokenizer",
                    "xml"
                ]
            ],
            "9" => [
                "phpversion" => "8.0.2",
                "extensions" => [
                    "bcmath",
                    "ctype",
                    "fileinfo",
                    "json",
                    "mbstring",
                    "openssl",
                    "pdo",
                    "tokenizer",
                    "xml"
                ]
            ],
            "10" => [
                "phpversion" => "8.1.0",
                "extensions" => [
                    "bcmath",
                    "ctype",
                    "curl",
                    "dom",
                    "fileinfo",
                    "json",
                    "mbstring",
                    "openssl",
                    "pcre",
                    "pdo",
                    "tokenizer",
                    "xml"
                ]
            ],
            "11" => [
                "phpversion" => "8.2.0",
                "extensions" => [
                    "ctype",
                    "curl",
                    "dom",
                    "fileinfo",
                    "filter",
                    "json",
                    "libxml",
                    "mbstring",
                    "openssl",
                    "pcre",
                    "phar",
                    "reflection",
                    "simplexml",
                    "spl",
                    "tokenizer",
                    "xml",
                    "xmlwriter"
                ]
            ]

        ];
        if (!key_exists($laravelMajorVersion, $phpExtensionRequirements)) {
            $laravelMajorVersion = "11";
        }
        $phpVersionRequired = $phpExtensionRequirements[$laravelMajorVersion]["phpversion"];
        $results->add(
            "Laravel version",
            $laravelVersion . " ( " . $laravelMajorVersion . " )"
        );
        $results->add(
            "PHP version",
            $phpVersion
        );
        $results->add(
            "PHP version required (min)",
            $phpVersionRequired
        );

        $helpInstall = [
            "bcmath" => "BCMath Arbitrary Precision Mathematics: https://www.php.net/manual/en/bc.setup.php",
            "ctype" => "Character type checking: https://www.php.net/manual/en/book.ctype",
            "curl" => "Client URL Library: https://www.php.net/manual/en/book.curl.php",
            "dom" => "Document Object Model: https://www.php.net/manual/en/book.dom.php",
            "fileinfo" => "File Information: https://www.php.net/manual/en/book.fileinfo",
            "filter" => "Data Filtering: https://www.php.net/manual/en/book.filter.php",
            "json" => "JavaScript Object Notation: https://www.php.net/manual/en/book.json",
            "libxml" => "libxml: https://www.php.net/manual/en/book.libxml.php",
            "mbstring" => "Multibyte string: https://www.php.net/manual/en/book.mbstring.php",
            "openssl" => "OpenSSL: https://www.php.net/manual/en/book.openssl.php",
            "pcre" => "Regular Expressions (Perl-Compatible): https://www.php.net/manual/en/book.pcre.php",
            "pdo" => "PHP Data Objects: https://www.php.net/manual/en/book.pdo.php",
            "phar" => "Phar: https://www.php.net/manual/en/book.phar.php",
            "reflection" => "Reflection: https://www.php.net/manual/en/book.reflection.php",
            "simplexml" => "SimpleXML: https://www.php.net/manual/en/book.simplexml.php",
            "spl" => "Standard PHP Library (SPL): https://www.php.net/manual/en/book.spl.php",
            "tokenizer" => "Tokenizer: https://www.php.net/manual/en/book.tokenizer.php",
            "xml" => "XML Parser: https://www.php.net/manual/en/book.xml.php",
            "xmlwriter" => "XMLWriter: https://www.php.net/manual/en/book.xmlwriter.php"
        ];
        $modulesOk = [];
        $modulesNotok = [];
        foreach ($phpExtensionRequirements[$laravelMajorVersion]["extensions"] as $p) {
            if (extension_loaded($p)) {
                $modulesOk[] = $p;
            } else {
                $modulesNotok[] = $p;
            }
        }
        //*** CHECK PHP VERSION
        if (version_compare($phpVersion, $phpVersionRequired) < 0) {
            $this->checksBag->addWarningAndHint(
                "PHP (" . $phpVersion . ") version check",
                "PHP version required: " . $phpVersionRequired . ", you have: " . $phpVersion,
                "You need to install PHP version: " . $phpVersionRequired
            );
        }
        $results->add(
            "PHP (" . $phpVersion . ") version check",
            "PHP version required: " . $phpVersionRequired . ", you have: " . $phpVersion
        );
        $results->add(
            "PHP extensions installed",
            implode(",", $modulesOk)
        );
        if (count($modulesNotok) > 0) {
            $stringHint = "Please install these modules :" . PHP_EOL;
            foreach ($modulesNotok as $pko) {
                if (key_exists($pko, $helpInstall)) {
                    $stringHint = $pko . " : " . $helpInstall[$pko] . PHP_EOL;
                } else {
                    $stringHint = $pko . PHP_EOL;
                }
            }
            $this->checksBag->addWarningAndHint(
                "PHP extensions missing",
                "Some PHP Extensions are missing",
                $stringHint
            );
        } else {
            $results->add(
                "PHP extension installed",
                "Looks good for Laravel " . $laravelMajorVersion
            );
        }
        return $results;
    }

    public function getPhpExtensions(): \HiFolks\LaraLens\ResultLens
    {
        $results = new ResultLens();
        foreach (get_loaded_extensions() as $name) {
            $results->add(
                $name,
                ""
            );
        }
        return $results;
    }

    public function getPhpIniValues(): \HiFolks\LaraLens\ResultLens
    {
        $results = new ResultLens();
        foreach (ini_get_all() as $name => $row) {
            $results->add(
                $name,
                $row['local_value']
            );
        }
        return $results;
    }
}


================================================
FILE: src/Lens/Traits/TermOutput.php
================================================
<?php

namespace HiFolks\LaraLens\Lens\Traits;

use function Termwind\{render};

trait TermOutput
{
    public function printOutputTerm(
        string $title,
        array $rows
    ) {
        render(
            view('lara-lens::laralens.term.table', [
                'title' => $title,
                'rows' => $rows
            ])
        );
    }

    public function printChecksTerm(array $rows): void
    {
        render(
            view('lara-lens::laralens.term.checks', [
                'rows' => $rows
            ])
        );
    }
    public function title(string $title): void
    {
        render("<div class='w-full mx-1 py-1 mt-1 text-center font-bold  bg-orange text-white'>$title</div>");
    }
}


================================================
FILE: src/ResultLens.php
================================================
<?php

namespace HiFolks\LaraLens;

class ResultLens
{
    private $result = null;
    private int $idx = -1;

    public const LINE_TYPE_ERROR   = 'error';
    public const LINE_TYPE_WARNING = 'warning';
    public const LINE_TYPE_INFO = 'info';
    public const LINE_TYPE_HINT    = 'hint';
    public const LINE_TYPE_DEFAULT = 'default';


    public function __construct()
    {
        $this->reset();
    }

    public function reset(): void
    {
        $this->result = collect();
        $this->idx = -1;
    }

    public function addError($label, $value): void
    {
        $this->add($label, $value, true, self::LINE_TYPE_ERROR);
    }

    public function addWarning($label, $value): void
    {
        $this->add($label, $value, true, self::LINE_TYPE_WARNING);
    }
    public function addInfo($label, $value): void
    {
        $this->add($label, $value, true, self::LINE_TYPE_INFO);
    }


    public function addHint($value): void
    {
        $this->add("*** HINT", $value, true, self::LINE_TYPE_HINT);
    }
    public function addErrorAndHint($label, $errorMessage, $hintMessage): void
    {
        $this->addError($label, $errorMessage);
        $this->addHint($hintMessage);
    }
    public function addWarningAndHint($label, $warningMessage, $hintMessage): void
    {
        $this->addWarning($label, $warningMessage);
        $this->addHint($hintMessage);
    }
    public function addInfoAndHint($label, $infoMessage, $hintMessage): void
    {
        $this->addInfo($label, $infoMessage);
        $this->addHint($hintMessage);
    }

    public function add($label, $value, $forceLine = false, $lineType = self::LINE_TYPE_DEFAULT): void
    {
        $this->result->push(
            [
                "label" => $label,
                "value" => $value,
                "isLine" => $forceLine,
                "lineType" => $lineType
            ]
        );
        $this->idx++;
    }

    /**
     * @return bool
     */
    public static function isMessageLine(string $lineType)
    {
        return (($lineType === self::LINE_TYPE_ERROR) ||
            ($lineType === self::LINE_TYPE_WARNING) ||
            ($lineType === self::LINE_TYPE_INFO));
    }
    public static function isHintLine($lineType): bool
    {
        return ($lineType === self::LINE_TYPE_HINT);
    }


    public function toArray()
    {
        return $this->result->toArray();
    }
}


================================================
FILE: tests/Feature/ConsistencyTest.php
================================================
<?php

use Illuminate\Support\Facades\Http;

test('config_array', function () {
    expect(laralens())->getConfigs()
    ->toArray()
    ->toBeArray()
    ->toHaveCount(14)
    ->checksBag->toArray()
    ->toBeArray()
    ->toBeEmpty(); //test check config length 0


    config(['app.debug' => true]);
    config(['app.env' => "production"]);

    expect(laralens())->getConfigs()
    ->toArray()
    ->toBeArray()
    ->toHaveCount(14)
    ->checksBag->toArray()
    ->toBeArray()
    ->toHaveCount(2);  // 2 =  1 for the warning , 1 for the hint
});

it('can retrieve runtimeconfig as array of 22 items')
    ->expect(fn () => laralens())
    ->getRuntimeConfigs()->toArray()
    ->toBeArray()
    ->toHaveCount(22);

it('can retrieve databases as array with 8-13 items')
    ->expect(fn () => laralens())
    ->getDatabase()->toArray()
    ->toBeArray()
    ->toHaveCountBetween(8, 13);

test('facade', function () {
    $this->assertIsObject($this->app["lara-lens"], "Test object facade");
});

test('Credits returned as non-empty array')
    ->expect(fn () => laralens())
    ->getCredits()->toArray()
    ->toBeArray()
    ->not()->toBeEmpty();

it('can retrieve PHP extensions as array')
    ->expect(fn () => laralens())
    ->getPhpExtensions()->toArray()
    ->toBeArray()
    ->not()->toBeEmpty();

it('can retrieve PHP ini as array')
    ->expect(fn () => laralens())
    ->getPhpIniValues()->toArray()
    ->toBeArray()
    ->not()->toBeEmpty();

it('can retrieve OS config as array')
    ->expect(fn () => laralens())
    ->getOsConfigs()->toArray()
    ->toBeArray()
    ->toHaveCountBetween(0, 8);

test('connection_array', function () {
    Http::fake();

    expect(fn () => laralens())
        ->getConnections()->toArray()
        ->toBeArray()
        ->toHaveCount(3);
})->skip();


================================================
FILE: tests/Pest.php
================================================
<?php


use HiFolks\LaraLens\Lens\LaraLens;
use HiFolks\LaraLens\Tests\TestCase;

/*
|--------------------------------------------------------------------------
| Test Case
|--------------------------------------------------------------------------
|
| The closure you provide to your test functions is always bound to a specific PHPUnit test
| case class. By default, that class is "PHPUnit\Framework\TestCase". Of course, you may
| need to change it using the "uses()" function to bind a different classes or traits.
|
*/

uses(TestCase::class)->in('Feature');

/*
|--------------------------------------------------------------------------
| Expectations
|--------------------------------------------------------------------------
|
| When you're writing tests, you often need to check that values meet certain conditions. The
| "expect()" function gives you access to a set of "expectations" methods that you can use
| to assert different things. Of course, you may extend the Expectation API at any time.
|
*/

expect()->extend('toHaveCountBetween', function (int $min, int $max) {
    expect(count($this->value))->toBeGreaterThanOrEqual($min)
                ->toBeLessThanOrEqual($max);
    return $this;
});


/*
|--------------------------------------------------------------------------
| Functions
|--------------------------------------------------------------------------
|
| While Pest is very powerful out-of-the-box, you may have some testing code specific to your
| project that you don't want to repeat in every file. Here you can also expose helpers as
| global functions to help you to reduce the number of lines of code in your test files.
|
*/

/**
 * Returns a new instance of Laralens
 *
 * @return LaraLens
 */
function laralens(): LaraLens
{
    return new LaraLens();
}


================================================
FILE: tests/TestCase.php
================================================
<?php

namespace HiFolks\LaraLens\Tests;

use HiFolks\LaraLens\LaraLensServiceProvider;
use Orchestra\Testbench\TestCase as OrchestraTestCase;

class TestCase extends OrchestraTestCase
{
    protected function getPackageProviders($app)
    {
        return [LaraLensServiceProvider::class];
    }
}
Download .txt
gitextract_66wvtac2/

├── .editorconfig
├── .gitattributes
├── .github/
│   └── workflows/
│       ├── php-code-quality.yml
│       └── php-lint.yml
├── .gitignore
├── CHANGELOG.md
├── CONTRIBUTING.md
├── LICENSE.md
├── README.md
├── composer.json
├── config/
│   └── config.php
├── phpcs.xml
├── phpstan.neon
├── phpunit.xml.dist
├── phpunit.xml.dist.bak
├── pint.json
├── psalm.xml
├── rector.php
├── resources/
│   └── views/
│       └── laralens/
│           ├── index.blade.php
│           └── term/
│               ├── checks.blade.php
│               └── table.blade.php
├── routes/
│   └── web.php
├── src/
│   ├── Console/
│   │   └── LaraLensCommand.php
│   ├── Http/
│   │   └── Controllers/
│   │       ├── Controller.php
│   │       └── LaraLensController.php
│   ├── LaraLensFacade.php
│   ├── LaraLensServiceProvider.php
│   ├── Lens/
│   │   ├── LaraHttp.php
│   │   ├── LaraLens.php
│   │   ├── Objects/
│   │   │   └── LaraHttpResponse.php
│   │   └── Traits/
│   │       ├── BaseTraits.php
│   │       ├── ConfigLens.php
│   │       ├── DatabaseLens.php
│   │       ├── FilesystemLens.php
│   │       ├── HttpConnectionLens.php
│   │       ├── OperatingSystemLens.php
│   │       ├── RuntimeLens.php
│   │       └── TermOutput.php
│   └── ResultLens.php
└── tests/
    ├── Feature/
    │   └── ConsistencyTest.php
    ├── Pest.php
    └── TestCase.php
Download .txt
SYMBOL INDEX (73 symbols across 19 files)

FILE: src/Console/LaraLensCommand.php
  class LaraLensCommand (line 10) | class LaraLensCommand extends Command
    method allConfigs (line 53) | private function allConfigs(): void
    method overview (line 58) | private function overview($checkTable = "users", $columnSorting = "cre...
    method handle (line 116) | public function handle(): void

FILE: src/Http/Controllers/Controller.php
  class Controller (line 10) | class Controller extends BaseController

FILE: src/Http/Controllers/LaraLensController.php
  class LaraLensController (line 7) | class LaraLensController extends Controller
    method index (line 9) | public function index(): \Illuminate\View\View

FILE: src/LaraLensFacade.php
  class LaraLensFacade (line 7) | class LaraLensFacade extends Facade
    method getFacadeAccessor (line 14) | protected static function getFacadeAccessor()

FILE: src/LaraLensServiceProvider.php
  class LaraLensServiceProvider (line 10) | class LaraLensServiceProvider extends ServiceProvider
    method boot (line 15) | public function boot(): void
    method registerRoutes (line 59) | protected function registerRoutes(): void
    method routeConfiguration (line 71) | protected function routeConfiguration(): array
    method register (line 82) | public function register()

FILE: src/Lens/LaraHttp.php
  class LaraHttp (line 9) | class LaraHttp
    method get (line 11) | public static function get($url): LaraHttpResponse

FILE: src/Lens/LaraLens.php
  class LaraLens (line 13) | class LaraLens
    method __construct (line 27) | public function __construct()
    method getCredits (line 35) | public function getCredits()
    method printBool (line 51) | public static function printBool(bool $b)

FILE: src/Lens/Objects/LaraHttpResponse.php
  class LaraHttpResponse (line 7) | class LaraHttpResponse
    method __construct (line 12) | public function __construct(private ResponseInterface $response)
    method status (line 21) | public function status()
    method failed (line 31) | public function failed()

FILE: src/Lens/Traits/BaseTraits.php
  type BaseTraits (line 7) | trait BaseTraits
    method stripPrefixDir (line 9) | protected function stripPrefixDir($value)

FILE: src/Lens/Traits/ConfigLens.php
  type ConfigLens (line 7) | trait ConfigLens
    method getConfigsDatabaseFromEnv (line 9) | public function getConfigsDatabaseFromEnv(ResultLens|null $results = n...
    method checkDebugEnv (line 30) | public function checkDebugEnv(ResultLens|null $results = null): \HiFol...
    method getConfigsDatabase (line 55) | public function getConfigsDatabase(ResultLens|null $results = null): \...
    method getConfigs (line 78) | public function getConfigs()

FILE: src/Lens/Traits/DatabaseLens.php
  type DatabaseLens (line 11) | trait DatabaseLens
    method getTablesListMysql (line 13) | public function getTablesListMysql(): string
    method getTablesListSqlite (line 25) | public function getTablesListSqlite(): string
    method dbConnection (line 40) | public function dbConnection(): false|\Illuminate\Database\Connection
    method getDatabaseConnectionInfos (line 56) | public function getDatabaseConnectionInfos(
    method getDatabase (line 189) | public function getDatabase($checkTable = "users", $columnSorting = "c...

FILE: src/Lens/Traits/FilesystemLens.php
  type FilesystemLens (line 8) | trait FilesystemLens
    method links (line 12) | protected function links()
    method checkFiles (line 18) | public function checkFiles(): \HiFolks\LaraLens\ResultLens

FILE: src/Lens/Traits/HttpConnectionLens.php
  type HttpConnectionLens (line 8) | trait HttpConnectionLens
    method getConnections (line 10) | public function getConnections($checkPath): \HiFolks\LaraLens\ResultLens

FILE: src/Lens/Traits/OperatingSystemLens.php
  type OperatingSystemLens (line 7) | trait OperatingSystemLens
    method getUnameValues (line 9) | private function getUnameValues($results): void
    method getOsConfigs (line 28) | public function getOsConfigs(): \HiFolks\LaraLens\ResultLens

FILE: src/Lens/Traits/RuntimeLens.php
  type RuntimeLens (line 9) | trait RuntimeLens
    method appCaller (line 11) | private function appCaller($results, $functions): void
    method getIniValues (line 28) | private function getIniValues($results): void
    method getRuntimeConfigs (line 42) | public function getRuntimeConfigs(): \HiFolks\LaraLens\ResultLens
    method checkServerRequirements (line 86) | public function checkServerRequirements(): \HiFolks\LaraLens\ResultLens
    method getPhpExtensions (line 278) | public function getPhpExtensions(): \HiFolks\LaraLens\ResultLens
    method getPhpIniValues (line 290) | public function getPhpIniValues(): \HiFolks\LaraLens\ResultLens

FILE: src/Lens/Traits/TermOutput.php
  type TermOutput (line 7) | trait TermOutput
    method printOutputTerm (line 9) | public function printOutputTerm(
    method printChecksTerm (line 21) | public function printChecksTerm(array $rows): void
    method title (line 29) | public function title(string $title): void

FILE: src/ResultLens.php
  class ResultLens (line 5) | class ResultLens
    method __construct (line 17) | public function __construct()
    method reset (line 22) | public function reset(): void
    method addError (line 28) | public function addError($label, $value): void
    method addWarning (line 33) | public function addWarning($label, $value): void
    method addInfo (line 37) | public function addInfo($label, $value): void
    method addHint (line 43) | public function addHint($value): void
    method addErrorAndHint (line 47) | public function addErrorAndHint($label, $errorMessage, $hintMessage): ...
    method addWarningAndHint (line 52) | public function addWarningAndHint($label, $warningMessage, $hintMessag...
    method addInfoAndHint (line 57) | public function addInfoAndHint($label, $infoMessage, $hintMessage): void
    method add (line 63) | public function add($label, $value, $forceLine = false, $lineType = se...
    method isMessageLine (line 79) | public static function isMessageLine(string $lineType)
    method isHintLine (line 85) | public static function isHintLine($lineType): bool
    method toArray (line 91) | public function toArray()

FILE: tests/Pest.php
  function laralens (line 54) | function laralens(): LaraLens

FILE: tests/TestCase.php
  class TestCase (line 8) | class TestCase extends OrchestraTestCase
    method getPackageProviders (line 10) | protected function getPackageProviders($app)
Condensed preview — 42 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (94K chars).
[
  {
    "path": ".editorconfig",
    "chars": 312,
    "preview": "; This file is for unifying the coding style for different editors and IDEs.\n; More information at http://editorconfig.o"
  },
  {
    "path": ".gitattributes",
    "chars": 395,
    "preview": "# Path-based git attributes\n# https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html\n\n# Ignore all test and"
  },
  {
    "path": ".github/workflows/php-code-quality.yml",
    "chars": 2101,
    "preview": "name: Code Quality Workflow\non:\n  push:\n    branches:\n      - develop\n      - features/**\n      - feature/**\n      - upg"
  },
  {
    "path": ".github/workflows/php-lint.yml",
    "chars": 557,
    "preview": "name: PHP Syntax Checker (Lint)\n\non:\n  push:\n    branches: [ develop ]\n  pull_request:\n    branches: [ develop ]\n\njobs:\n"
  },
  {
    "path": ".gitignore",
    "chars": 107,
    "preview": "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",
    "chars": 8448,
    "preview": "# 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-"
  },
  {
    "path": "CONTRIBUTING.md",
    "chars": 3486,
    "preview": "# Contributing\n\nContributions are **welcome** and will be fully **credited**.\n\nPlease read and understand the contributi"
  },
  {
    "path": "LICENSE.md",
    "chars": 1064,
    "preview": "MIT License\n\nCopyright (c) Roberto Butti\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\no"
  },
  {
    "path": "README.md",
    "chars": 7272,
    "preview": "# LaraLens\n\n\n![CI/CD Github Actions](https://img.shields.io/github/actions/workflow/status/hi-folks/lara-lens/php-code-q"
  },
  {
    "path": "composer.json",
    "chars": 2465,
    "preview": "{\n    \"name\": \"hi-folks/lara-lens\",\n    \"description\": \"Laravel Diagnostic command for configuration, db connection, htt"
  },
  {
    "path": "config/config.php",
    "chars": 347,
    "preview": "<?php\n\n/*\n * LaraLens Configuration.\n */\nreturn [\n    'prefix' => env('LARALENS_PREFIX', 'laralens'), // URL prefix (def"
  },
  {
    "path": "phpcs.xml",
    "chars": 297,
    "preview": "<?xml version=\"1.0\"?>\n<ruleset  name=\"PHP_CodeSniffer\">\n    <description>PHPCS configuration file.</description>\n    <fi"
  },
  {
    "path": "phpstan.neon",
    "chars": 266,
    "preview": "includes:\n    - ./vendor/larastan/larastan/extension.neon\nparameters:\n    reportUnmatchedIgnoredErrors: false\n    ignore"
  },
  {
    "path": "phpunit.xml.dist",
    "chars": 921,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<phpunit xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" bootstrap=\"vendor/"
  },
  {
    "path": "phpunit.xml.dist.bak",
    "chars": 982,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<phpunit xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" bootstrap=\"vendor/"
  },
  {
    "path": "pint.json",
    "chars": 26,
    "preview": "{\n    \"preset\": \"psr12\"\n}\n"
  },
  {
    "path": "psalm.xml",
    "chars": 510,
    "preview": "<?xml version=\"1.0\"?>\n<psalm\n    errorLevel=\"4\"\n    resolveFromConfigFile=\"true\"\n    xmlns:xsi=\"http://www.w3.org/2001/X"
  },
  {
    "path": "rector.php",
    "chars": 515,
    "preview": "<?php\n\ndeclare(strict_types=1);\n\nuse Rector\\CodeQuality\\Rector\\Class_\\InlineConstructorDefaultToPropertyRector;\nuse Rect"
  },
  {
    "path": "resources/views/laralens/index.blade.php",
    "chars": 4280,
    "preview": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n    <meta charset=\"utf-8\" />\n    <meta name=\"viewport\" content=\"width=device-wid"
  },
  {
    "path": "resources/views/laralens/term/checks.blade.php",
    "chars": 2274,
    "preview": "<div class=\"mt-2 mx-1\">\n    @if (sizeof($rows) > 0)\n        <div class=\"flex space-x-1\">\n            <span class=\"text-r"
  },
  {
    "path": "resources/views/laralens/term/table.blade.php",
    "chars": 2190,
    "preview": "<div class=\"mt-1.5 mx-1\">\n    <div class=\"flex space-x-1\">\n        <span class=\"text-green\">{{ $title }}</span>\n        "
  },
  {
    "path": "routes/web.php",
    "chars": 183,
    "preview": "<?php\n\nuse Illuminate\\Support\\Facades\\Route;\nuse HiFolks\\LaraLens\\Http\\Controllers\\LaraLensController;\n\nRoute::get('/', "
  },
  {
    "path": "src/Console/LaraLensCommand.php",
    "chars": 7874,
    "preview": "<?php\n\nnamespace HiFolks\\LaraLens\\Console;\n\nuse HiFolks\\LaraLens\\Lens\\LaraLens;\nuse HiFolks\\LaraLens\\Lens\\Traits\\TermOut"
  },
  {
    "path": "src/Http/Controllers/Controller.php",
    "chars": 390,
    "preview": "<?php\n\nnamespace HiFolks\\LaraLens\\Http\\Controllers;\n\nuse Illuminate\\Foundation\\Bus\\DispatchesJobs;\nuse Illuminate\\Routin"
  },
  {
    "path": "src/Http/Controllers/LaraLensController.php",
    "chars": 2240,
    "preview": "<?php\n\nnamespace HiFolks\\LaraLens\\Http\\Controllers;\n\nuse HiFolks\\LaraLens\\Lens\\LaraLens;\n\nclass LaraLensController exten"
  },
  {
    "path": "src/LaraLensFacade.php",
    "chars": 300,
    "preview": "<?php\n\nnamespace HiFolks\\LaraLens;\n\nuse Illuminate\\Support\\Facades\\Facade;\n\nclass LaraLensFacade extends Facade\n{\n    /*"
  },
  {
    "path": "src/LaraLensServiceProvider.php",
    "chars": 2766,
    "preview": "<?php\n\nnamespace HiFolks\\LaraLens;\n\nuse HiFolks\\LaraLens\\Console\\LaraLensCommand;\nuse Illuminate\\Support\\ServiceProvider"
  },
  {
    "path": "src/Lens/LaraHttp.php",
    "chars": 502,
    "preview": "<?php\n\nnamespace HiFolks\\LaraLens\\Lens;\n\nuse GuzzleHttp\\Client;\nuse GuzzleHttp\\Exception\\GuzzleException;\nuse HiFolks\\La"
  },
  {
    "path": "src/Lens/LaraLens.php",
    "chars": 1058,
    "preview": "<?php\n\nnamespace HiFolks\\LaraLens\\Lens;\n\nuse HiFolks\\LaraLens\\Lens\\Traits\\ConfigLens;\nuse HiFolks\\LaraLens\\Lens\\Traits\\D"
  },
  {
    "path": "src/Lens/Objects/LaraHttpResponse.php",
    "chars": 643,
    "preview": "<?php\n\nnamespace HiFolks\\LaraLens\\Lens\\Objects;\n\nuse Psr\\Http\\Message\\ResponseInterface;\n\nclass LaraHttpResponse\n{\n    /"
  },
  {
    "path": "src/Lens/Traits/BaseTraits.php",
    "chars": 416,
    "preview": "<?php\n\nnamespace HiFolks\\LaraLens\\Lens\\Traits;\n\nuse Illuminate\\Support\\Str;\n\ntrait BaseTraits\n{\n    protected function s"
  },
  {
    "path": "src/Lens/Traits/ConfigLens.php",
    "chars": 2937,
    "preview": "<?php\n\nnamespace HiFolks\\LaraLens\\Lens\\Traits;\n\nuse HiFolks\\LaraLens\\ResultLens;\n\ntrait ConfigLens\n{\n    public function"
  },
  {
    "path": "src/Lens/Traits/DatabaseLens.php",
    "chars": 6696,
    "preview": "<?php\n\nnamespace HiFolks\\LaraLens\\Lens\\Traits;\n\nuse Illuminate\\Database\\Connection;\nuse Illuminate\\Database\\QueryExcepti"
  },
  {
    "path": "src/Lens/Traits/FilesystemLens.php",
    "chars": 2746,
    "preview": "<?php\n\nnamespace HiFolks\\LaraLens\\Lens\\Traits;\n\nuse HiFolks\\LaraLens\\ResultLens;\nuse Illuminate\\Support\\Facades\\App;\n\ntr"
  },
  {
    "path": "src/Lens/Traits/HttpConnectionLens.php",
    "chars": 1776,
    "preview": "<?php\n\nnamespace HiFolks\\LaraLens\\Lens\\Traits;\n\nuse HiFolks\\LaraLens\\Lens\\LaraHttp;\nuse HiFolks\\LaraLens\\ResultLens;\n\ntr"
  },
  {
    "path": "src/Lens/Traits/OperatingSystemLens.php",
    "chars": 937,
    "preview": "<?php\n\nnamespace HiFolks\\LaraLens\\Lens\\Traits;\n\nuse HiFolks\\LaraLens\\ResultLens;\n\ntrait OperatingSystemLens\n{\n    privat"
  },
  {
    "path": "src/Lens/Traits/RuntimeLens.php",
    "chars": 10352,
    "preview": "<?php\n\nnamespace HiFolks\\LaraLens\\Lens\\Traits;\n\nuse HiFolks\\LaraLens\\ResultLens;\nuse Illuminate\\Support\\Arr;\nuse Illumin"
  },
  {
    "path": "src/Lens/Traits/TermOutput.php",
    "chars": 724,
    "preview": "<?php\n\nnamespace HiFolks\\LaraLens\\Lens\\Traits;\n\nuse function Termwind\\{render};\n\ntrait TermOutput\n{\n    public function "
  },
  {
    "path": "src/ResultLens.php",
    "chars": 2400,
    "preview": "<?php\n\nnamespace HiFolks\\LaraLens;\n\nclass ResultLens\n{\n    private $result = null;\n    private int $idx = -1;\n\n    publi"
  },
  {
    "path": "tests/Feature/ConsistencyTest.php",
    "chars": 1804,
    "preview": "<?php\n\nuse Illuminate\\Support\\Facades\\Http;\n\ntest('config_array', function () {\n    expect(laralens())->getConfigs()\n   "
  },
  {
    "path": "tests/Pest.php",
    "chars": 1797,
    "preview": "<?php\n\n\nuse HiFolks\\LaraLens\\Lens\\LaraLens;\nuse HiFolks\\LaraLens\\Tests\\TestCase;\n\n/*\n|----------------------------------"
  },
  {
    "path": "tests/TestCase.php",
    "chars": 299,
    "preview": "<?php\n\nnamespace HiFolks\\LaraLens\\Tests;\n\nuse HiFolks\\LaraLens\\LaraLensServiceProvider;\nuse Orchestra\\Testbench\\TestCase"
  }
]

About this extraction

This page contains the full source code of the Hi-Folks/lara-lens GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 42 files (85.6 KB), approximately 22.2k tokens, and a symbol index with 73 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!