stickee / laravel-code-style
Installs: 579
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 1
Open Issues: 2
Language:SCSS
Requires
- friendsofphp/php-cs-fixer: ^2.15
- sensiolabs/security-checker: ^6.0
This package is auto-updated.
Last update: 2023-02-17 13:58:03 UTC
README
This repo has been replaced by Canary.
Stickee Laravel Code Style
This repository contains config files for tools for Laravel projects.
Usage
First install this package:
composer require --dev stickee/laravel-code-style
You should then be able to publish the assets using following command:
php artisan vendor:publish
The stickee-configs
contain good defaults for all projects, and the stickee-resources
contains
scaffolding which is recommended if your starting a new project.
You then need to install js code style
npm install stickee-javascript-code-style
Highly recommend Husky to greatly improve the quality of code committed into GIT.
It automates a LOT of tasks. Have a peek into .huskyrc
and .lintstagedrc
for an insight into what it does.
npm install --save-dev husky lint-staged stylelint stylelint-config-sass-guidelines
Once installed, please confirm the .huskyrc
and .lintstagedrc
are doing what you expect. Some projects
(e.g. PyroCMS) may not have the same structure, or you may want to disable phpunit tests if tests become slow.
Recommended
It's recommended to install Larastan in the project.
composer require --dev nunomaduro/larastan
Once installed, you can run ./vendor/bin/phpstan analyse
at anytime to scan your whole project, which gives you a very good insight into your code.
By default this is already set up in your .lintstagedrc
file, within the "*.php"
block.
"./vendor/bin/phpstan analyse --no-ansi --no-progress",
PHPCS
PHP-CS-Fixer can be manually ran using:
./vendor/bin/php-cs-fixer <COMMAND>
Docker
If you are using docker you will need to modify your .huskyrc
and .lintstagedrc
files to run the commands within the container. .huskyrc
for example:
"hooks": {
"pre-commit": "lint-staged -r",
"pre-push": "docker-compose exec -T php-fpm php vendor/bin/phpunit"
}
The php-fpm
should be updated to use your container name (use docker ps
to list your current containers).