PhpStorm Tips, ticks and standard setup
- Tips and Tracks for PHPStorm (PHPStorm Tips and Tricks.md)
- Standard setup for PHP projects (Standard.md)
#!/usr/bin/env bash | |
set -o errexit | |
set -o nounset | |
set -o pipefail | |
if [[ "${TRACE-0}" == "1" ]]; then | |
set -o xtrace | |
fi | |
if [[ "${1-}" =~ ^-*h(elp)?$ ]]; then |
<?php // ~/.config/psysh/config.php | |
// Anything not Laravel - let's try to autoload something likely to exist | |
if (!defined('LARAVEL_START')) { | |
return [ | |
'defaultIncludes' => [ | |
getcwd().'/vendor/autoload.php', | |
getcwd().'/bootstrap/autoload.php', | |
], | |
]; |
# Laravel Best Practices | |
Laravel is a PHP framework and just like any other PHP framework there are several ways to get a single thing done in a lot of cases, for conformity these are hand picked best practices. | |
1. Installation of every Laravel project should be done with: | |
```bash | |
composer create-project laravel/laravel {./} or {projectname-backend} | |
``` | |
2. The project name should be in kebab cases in the format: `{projectname-backend}` | |
3. All file names should be in title cases **ProductController, PostService, Category** | |
4. All services should be named after model name if tied to a model, else it should carry the name of the entity, and the suffix 'Service' i.e. {Name}Service |
<?php namespace Vendor\Library; | |
use Another\Vendor\Library\ClassName; | |
abstract class ClassName extends AnotherClass implements Countable, Serializable | |
{ | |
const CONSTANTS = 'top'; | |
use someTrait, anotherTrait { | |
anotherTrait::traitMethod insteadof someTrait; |
Various configuration and alias commands you can directly run from the command line.
Aliases are convenient shotcuts making your everyday work a little easier. This is especially true for commands that you use a lot and thus save you a lot of keystrokes, and for commands that are so long making them hard to remember and tidious to type. When designing an alias I make sure the abbreviation makes sence to me. In that way they are not too cryptic and makes sure I remember them more easily. I try to use the following methodology: