Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/chiiya/laravel-code-style
Code style and quality configurations for Laravel projects
https://github.com/chiiya/laravel-code-style
Last synced: 5 days ago
JSON representation
Code style and quality configurations for Laravel projects
- Host: GitHub
- URL: https://github.com/chiiya/laravel-code-style
- Owner: chiiya
- License: mit
- Created: 2022-03-09T20:23:45.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2024-06-06T09:05:02.000Z (5 months ago)
- Last Synced: 2024-10-06T02:40:41.996Z (about 1 month ago)
- Language: PHP
- Size: 47.9 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: .github/CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE.md
- Security: .github/SECURITY.md
Awesome Lists containing this project
README
Laravel Code Style
Code style configurations for Laravel projects using a combination of PHP-CS-Fixer, ECS and Rector.
index
·
installation
·
usage
## Index
> Installation .....................................................................
> Usage ............................................................................## Installation
Install the package using composer. When prompted to create a GrumPHP configuration file, choose "No".
```bash
composer require chiiya/laravel-code-style --dev
```## Usage
```bash
# Publish config files
php artisan vendor:publish --tag="code-style-config"
```Next, adjust the `ecs.php`, `.php-cs-fixer.dist.php`, `rector.php` and `phpstan.neon` files
that have just been created in your project folder to suit your project structure.After publishing the configuration files, you may have to re-initialize GrumPHP:
```bash
php ./vendor/bin/grumphp git:deinit
php ./vendor/bin/grumphp git:init
```The GrumPHP config includes tasks for PHP-CS-Fixer, ECS and TLint by default. Tasks for `rector`
and `phpstan` are not included, since they can take a long time. You may choose to execute them
separately instead (for example, in a CI pipeline), or add them to your GrumPHP config if you're
fine with the longer waiting times:Example for `grumphp.yml`
```yaml
grumphp:
tasks:
# ...
rector: ~
phpstan: ~
```Example for a CI config (call these somewhere in your pipeline):
```bash
./vendor/bin/ecs check
./vendor/bin/php-cs-fixer fix --dry-run --diff
./vendor/bin/rector process --dry-run
./vendor/bin/tlint lint
./vendor/bin/phpstan analyse --memory-limit=2G
```