as in the defination by the official repository,
Laravel Pint is an opinionated PHP code style fixer for minimalists. Pint is built on top of PHP-CS-Fixer and makes it simple to ensure that your code style stays clean and consistent.
-- laravel/pint
and as per me, Pint is the so far most sophisticated code formatter i have ever user in the reference of PHP. You can find more details about laravel/pint here.
composer require laravel/pint --dev
to use the pint binary all you have to do is run the following command in the root of you laravel project.
./vendor/bin/pint
The default setup of laravel pint does not require any configuration and as per the official docs, it for PSR-12 Style Guide. Still if you are unhappy with some default rules you can change then by creating a pint.json in root of your project
, and adding the preset to it.
Currently the following preset are supported
Since Pint is based on PHP-CS-Fixer the configuration rules can be found here.
{
"preset": "symfony",
"rules": {
"concat_space": {
"spacing": "one"
}
}
}
So far we are good to use laravel/pint, but opening terminal and running a binary everytime you need to format id one hell of a job. To reduce that effort we will bind laravel/pint with our VS Code with the help of VS Code Task
.vscode directory in root of you project
, if you don't have one.new file named as tasks.json
to .vscode directory{
"version": "2.0.0",
"tasks": [
{
"label": "Pint Formatter",
"type": "shell",
"command": "./vendor/bin/pint",
"problemMatcher": [],
"presentation": {
"reveal": "silent"
},
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
You can run this task directly from the Tremial -> Run Tasks
from the navigation, but will do it a bit more simpler.
file -> preferences -> keyboard Shortcuts
or Ctrl+k Ctrl+s
[
{
"key": "ctrl+shift+l",
"command": "workbench.action.tasks.runTask",
"args": "Pint Formatter"
}
]
Now all you have to do is hit Ctrl + Shift + l
and your laravel project will formatted with laravel pint.
If you are more driven toward the extension approach you can get the above integration by using the following extension.
I have been using the unsatisfactory formatters from a long time. All of them have one thing but lack other. Laravel Pint is one who has it all, combining it with vscode is like proving you laravel project a super power.
Feel free to pick your brain in comments.
AppImages are the most easiest to run compared.The challenging task is to make the AppImage accessible globally through he system like an installed application (in the menu)
#express js #node #node js #sequelize #mysql
In the very initial days of my work in Node JS if faced this issue. Though Sequelize provide a great ORM for MySQL but the association within the models is a bit tricky.
#database #javascript #sequelize #npx
list of Sequelize CLI commands which comes handy, while working on a project.
#functionality #pwa #javascript #laravel
The progressive web app is the new trend as well as the need for the present time. I hope before getting in the “HOW” part you know what is exactly a PWA
I am familiar with the love of Eloquent among the laravel community but sometimes, sometimes its better to go for raw queries. Its saves you a lot of time and trouble.
#functionality #pwa #javascript #laravel
The progressive web app is the new trend as well as the need for the present time. I hope before getting in the “HOW” part you know what is exactly a PWA
I am familiar with the love of Eloquent among the laravel community but sometimes, sometimes its better to go for raw queries. Its saves you a lot of time and trouble.
As you may have known by now that laravel 6.0 has been out. Though it's expected to have a lot of changes in the major release but in 6.0 there are not that many changes.
below are mentioned things to be taken care of at the time of deploying a laravel project to production.
NO, this is not another list of same old same old list of extensions.