Laravel The PHP Framework For Web Artisans.
Voir aussi Lumen une version micro-framework de Laravel 5.
Tutoriels:
Exemples:
Tutorials:
Starters:
CMS :
Voir aussi model validation
Dans la documentation: routing csrf-excluding-uris
It's now super easy to exclude specific routes from your CSRF middleware:
source: https://mattstauffer.co/blog/excluding-routes-from-the-csrf-middleware-in-laravel-5.1
Plus d'information : Excluding Routes from the CSRF Middleware
// app/Http/Middleware/VerifyCsrfToken protected $except = [ 'webhook/*' ];
Utiliser côté client les règles de validation et messages d'erreurs définis pour les Models.
ModelForm, Laravel implementation of Django Forms, is a PHP Form Abstraction for Laravel based on Django Forms and Formset.
Gérer les versions des données
Gestion d'arborescence (Nested tree structure, Nested category) :
Doctrine avec Laravel: http://www.laraveldoctrine.org - Problème: à cause de la forte dépendance de Laravel avec Eloquent, les packages externes continueront d'utiliser Eloquent.
Laravel 5.2, you may define additional authentication drivers as well define multiple authenticatable models or user tables, and control their authentication process separately from each other. For example, if your application has one database table for “admin” users and one database table for “student” users, you may now use the Auth methods to authenticate against each of these tables separately.
Laravel 5.2: This command will generate plain, Bootstrap compatible views for user login, registration, and password reset. The command will also update your routes file with the appropriate routes.
Note: This feature is only meant to be used on new applications, not during application upgrades.
php artisan make:auth
Laravel Passport est le serveur OAuth officiel.
Autres:
source: https://mattstauffer.co/blog/passing-parameters-to-middleware-in-laravel-5.1
Using parameterized middleware in the route defintion. When you're adding middleware to a route definition, you'd normally set it like this:
Route::get('company', ['middleware' => 'auth', function () { return view('company.admin'); }]);
So, let's add in our parameter to show that the user must have the owner role:
Route::get('company', ['middleware' => 'auth:owner', function () { return view('company.admin'); }]);
Note that you can also pass multiple parameters as a comma-separated list:
Route::get('company', ['middleware' => 'auth:owner,view', function () { return view('company.admin'); }]);
Simply overload some methods:
class User extends BaseModel implements UserInterface, RemindableInterface { ... public function getRememberToken(){ return null; // not supported } public function setRememberToken($value){ // not supported } public function getRememberTokenName(){ return null; // not supported } /** * Overrides the method to ignore the remember token. */ public function setAttribute($key, $value) { $isRememberTokenAttribute = $key == $this->getRememberTokenName(); if (!$isRememberTokenAttribute) { parent::setAttribute($key, $value); } } ...
https://cartalyst.com/manual/sentinel
A modern and framework agnostic authorization and authentication package featuring:
The package follows the FIG standard PSR-4 (Autoloader) to ensure a high level of interoperability between shared PHP code.
The package requires PHP 5.4+ and comes bundled with a Laravel 5 Facade and a Service Provider to simplify the optional framework integration.
Laravel 5.2: Implicit Model Binding
use AppUser; Route::get('/user/{user}', function (User $user) { return $user; });
Simple but usefull RestControllerTrait
Dingo https://github.com/dingo/api/
JWT-auth provides a simple means of authentication within Laravel using JSON Web Tokens
Laravel Mix provides a fluent API for defining Webpack build steps for your Laravel application using several common CSS and JavaScript pre-processors.
La documentation View Composers présente l'insertion automatique de données dans des vues que je vois comme du “Component Push”. Ça manque d'exemple, notamment le paradigm du “Component Pull” : Exprimer l'insertion d'un composant depuis une vue.
Appeler le “composant” depuis une vue Blade:
@inject('navstage', 'NavStage') {{ echo $navstage->render() }}.
L'appel @inject()
demande au “Service Container” de trouver l'instance d'un objet référencé sous le nom NavStage
. Il faut donc que cet objet ai été créer et référencé:
// dans App/Providers/AppServiceProvider.php public function boot() { $this->app->singleton('NavStage', function ($app) { return new \App\Services\NavStage(); }); }
Il faut bien sûr qu'existe la classe \App\Services\NavStage
avec une méthode render()
(cf. la vue Blade).
Nota bene: l'appel {{ $navstage→render() }}
n'imprime pas le résultat de l'appel à render()
, il faut donc faire un echo
dans la méthode.
Nota bene Dans le cas d'un composant qui n'est pas utilisé dans toutes les requêtes, on va préférer le charger que si besoin : Deferred Providers (aka lazy loading)
CKeditor laravel package:
Laravel file manager (for CKEditor and TinyMCE) with multi-users support
voir Vue.js
Since many JavaScript frameworks also use “curly” braces to indicate a given expression should be displayed in the browser, you may use the @ symbol to inform the Blade … Blade & JavaScript Frameworks
Messages de validation en 52 langues pour Laravel4/5: https://github.com/caouecs/Laravel-lang
Manage translation in database:
Manage translation files:
Translation in Eloquent ORM
Cache Lock appears with Laravel 5.5, only for Redis et Memcached cache driver. It's not in the cache documentation but in Release documentation.
try { $lock = Cache::lock('foo', 10)->block(5); // Lock acquired after waiting maximum of 5 seconds... } catch (LockTimeoutException $e) { // Unable to acquire lock... } finally { optional($lock)->release(); }
Le middleware Illuminate\Routing\Middleware\ThrottleRequests retourne un code HTTP 429 quand le nombre de requêtes dans un nombre de minutes est dépassé.
Il utilise le cache Illuminate\Cache\RateLimiter. Pour identifier le client il utilise la méthode fingerprint()
de Illuminate\Http\Request.
Malheureusement cette méthode fingerprint()
n'utilise que l'IP comme données du client.
Bien qu'il soit impossible de calculer une empreinte sure, j'ai demandé l'ajout du remote port #12872.
Ce bug n'est-il pas réapparu ? Un test unitaire existe-t-il ?
Laravel cookie forgery, decryption, and RCE MWR, 11 April 2014
To make default prefixed route working, like /admin
or /foo
, while a folder with the same name exists, like public/admin
or public/foo
, should remove the $uri/ from nginx rewriting:
replace location / { try_files $uri $uri/ /index.php?$query_string ; } by location / { try_files $uri /index.php?$query_string ; }
Menus, CRUD & more :
Not free:
- Get your APIs and Admin Panel ready in minutes, Laravel Generator to generate CRUD, APIs, Test Cases and Swagger Documentation (read http://laravel.sillo.org/infyom/).
Not free:
- Laravel Admin Template Front End CRUD
Posts:
Libs:
Posts:
Libs: