Contributions are welcome. Please make all pull requests agaist the development branch (currently 8.x.x) and NOT master which is only for releases.
We accept contributions via Pull Requests on Github.
Working on your first Pull Request? You can learn how from this free series How to Contribute to an Open Source Project on GitHub
Commit Title Standard
Please use the following title schema.
- prefix: Title
Examples:
- update: French Translations
- fix: French Translations
- security fix: French Translations
- remove: French Translations
- add: French Translations
- revert: French Translations
- refactor: French Translations
https://www.conventionalcommits.org/en/v1.0.0/
PR Title Standard
Please use the following title schema.
- (PREFIX) Title
Examples:
- (Update) French Translations
- (Fix) French Translations
- (Security Fix) French Translations
- (Remove) French Translations
- (Add) French Translations
- (Revert) French Translations
- (Refactor) French Translations
- Check the code style with
$ composer check-style
and fix it with$ composer fix-style
.
Follow Laravel naming conventions
What | How | Good | Bad |
---|---|---|---|
Controller | singular | ArticleController | |
Route | plural | articles/1 | |
Route name | snake_case with dot notation | users.show_active | |
Model | singular | User | |
hasOne or belongsTo relationship | singular | articleComment | |
All other relationships | plural | articleComments | |
Table | plural | article_comments | |
Pivot table | singular model names in alphabetical order | article_user | |
Table column | snake_case without model name | meta_title | |
Model property | snake_case | $model->created_at | |
Foreign key | singular model name with _id suffix | article_id | |
Primary key | - | id | |
Migration | - | 2017_01_01_000000_create_articles_table | |
Method | camelCase | getAll | |
Method in resource controller | table | store | |
Method in test class | camelCase | testGuestCannotSeeArticle | |
Variable | camelCase | $articlesWithAuthor | |
Collection | descriptive, plural | $activeUsers = User::active()->get() | |
Object | descriptive, singular | $activeUser = User::active()->first() | |
Config and language files index | snake_case | articles_enabled | |
View | kebab-case | show-filtered.blade.php | |
Config | snake_case | google_calendar.php | |
Contract (interface) | adjective or noun | AuthenticationInterface | |
Trait | adjective | Notifiable | |
Trait (PSR) | adjective | NotifiableTrait | |
Enum | singular | UserType | |
FormRequest | singular | UpdateUserRequest | |
Seeder | singular | UserSeeder |
Use Laravel helpers when possible and not facades - auth(), info(), cache(), response(), ext. Laravel Helpers
Use shortened syntax when possible - Example: []
and not array()
.
Common syntax | Shorter and more readable syntax |
---|---|
Session::get('cart') |
session('cart') |
$request->session()->get('cart') |
session('cart') |
Session::put('cart', $data) |
session(['cart' => $data]) |
$request->input('name'), Request::get('name') |
$request->name, request('name') |
return Redirect::back() |
return back() |
is_null($object->relation) ? null : $object->relation->id |
optional($object->relation)->id (in PHP 8: $object->relation?->id ) |
$request->has('value') ? $request->value : 'default'; |
$request->get('value', 'default') |
App::make('Class') |
app('Class') |
->orderBy('created_at', 'desc') |
->latest() |
->orderBy('age', 'desc') |
->latest('age') |
->orderBy('created_at', 'asc') |
->oldest() |
-
Document any change in behaviour - Make sure the
README.md
and any other relevant documentation are kept up-to-date. -
Create feature branches - Don't ask us to pull from your master branch.
-
One pull request per feature - If you want to do more than one thing, send multiple pull requests.
Happy coding!