Skip to content

Commit

Permalink
Merge pull request #63 from Hi-Folks/develop
Browse files Browse the repository at this point in the history
v0.2.6
  • Loading branch information
roberto-butti authored Oct 3, 2021
2 parents 7187162 + 2341186 commit a074d8e
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 48 deletions.
18 changes: 0 additions & 18 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,29 +14,11 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Get Composer Cache Directory 2
id: composer-cache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"
- uses: actions/cache@v2
id: actions-cache
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Cache PHP dependencies
uses: actions/cache@v2
id: vendor-cache
with:
path: vendor
key: ${{ runner.OS }}-build-${{ hashFiles('**/composer.lock') }}

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

- name: Install dependencies
if: steps.vendor-cache.outputs.cache-hit != 'true'
run: composer install --prefer-dist --no-progress

- name: Run test suite
Expand Down
21 changes: 2 additions & 19 deletions .github/workflows/test-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
- main
- develop
- features/**
- fix/**

jobs:
laravel-tests:
Expand All @@ -26,28 +27,10 @@ jobs:
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
- name: Get Composer Cache Directory 2
id: composer-cache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"
- uses: actions/cache@v2
id: actions-cache
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Cache PHP dependencies
uses: actions/cache@v2
id: vendor-cache
with:
path: vendor
key: ${{ runner.OS }}-build-${{ hashFiles('**/composer.lock') }}

- name: Install Dependencies
if: steps.vendor-cache.outputs.cache-hit != 'true'
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist


- name: Show dir
run: pwd
- name: PHP Version
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ coverage
.phpunit.result.cache
.idea
.php_cs.cache
.vscode
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## 0.2.6 - 2021-01-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:
Expand All @@ -10,7 +17,7 @@
- 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 )
Expand Down
18 changes: 15 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,23 @@ 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.

## Requirements
## Open a Pull Request

If the project maintainer has any additional requirements, you will find them listed here.
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 [PHP Code Sniffer](https://pear.php.net/package/PHP_CodeSniffer);
- **PHPstan** with [level 4](https://phpstan.org/user-guide/rule-levels)
- **Phpunit** to execute all tests from ./tests/*

- **[PSR-2 Coding Standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)** - The easiest way to apply the conventions is to install [PHP Code Sniffer](https://pear.php.net/package/PHP_CodeSniffer).
I suggest to launch *make allchecks* 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.

Expand Down
25 changes: 18 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@ 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
Expand All @@ -102,7 +107,7 @@ php artisan laralens:diagnostic --show=php-ini
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
php artisan laralens:diagnostic --skip-database
```

### Usage: show some oprating system information
Expand All @@ -115,7 +120,7 @@ You can show some operating system information like:
- Machine Name
- Version info

using _"--show os"_ option or _"--show all"_ option
using _"--show os"_ option or _"--show all"_ option
```shell
php artisan laralens:diagnostic --show os
```
Expand All @@ -135,6 +140,12 @@ For example:
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

Expand Down Expand Up @@ -162,12 +173,12 @@ After that,you will have a new configuration file in your config directory. The
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
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"
```
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

Expand All @@ -181,12 +192,12 @@ return [

### 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_
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
Expand Down
5 changes: 5 additions & 0 deletions src/Console/LaraLensCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class LaraLensCommand extends Command
{--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)}
Expand All @@ -30,6 +31,7 @@ class LaraLensCommand extends Command
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;

Expand Down Expand Up @@ -256,6 +258,9 @@ public function handle()

$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)) {
Expand Down

0 comments on commit a074d8e

Please sign in to comment.