Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente |
informatique:php:laravel [28/06/2023 08:46] – [Twig template engine with Laravel] cyrille | informatique:php:laravel [26/04/2024 09:19] (Version actuelle) – [Documentation] cyrille |
---|
[[http://laravel.com|Laravel]] The PHP Framework For Web Artisans. | [[http://laravel.com|Laravel]] The PHP Framework For Web Artisans. |
| |
Voir aussi [[/informatique/php/lumen|Lumen]] une version micro-framework de Laravel 5. | Voir aussi : |
| * [[/informatique/php/lumen|Lumen]] une version micro-framework de Laravel 5. |
| * [[informatique/web/tailwind_css|informatique/web/Tailwind Css]] |
===== Documentation ===== | ===== Documentation ===== |
| |
* [[https://laravel.com/docs/8.x|Laravel 8.x]] | * [[https://laravel.com/docs/8.x|Laravel 8.x]] |
* [[https://laravel.sillo.org/la-tall-stack/|La TALL Stack]] Tailwind, AlpineJS, Laravel et Livewire | * [[https://laravel.sillo.org/la-tall-stack/|La TALL Stack]] Tailwind CSS, [[/informatique/javascript/AlpineJS|AlpineJS]], Laravel et Livewire |
* [[https://github.com/laravel-frontend-presets|laravel-frontend-presets]], en plus des quelques ui presets fournis par Laravel pour un simple dashboard ou la tall stack ou ... de simples mais jolis dashboards comme [[https://www.creative-tim.com/live/paper-dashboard-laravel|paper-dashboard-laravel]] | * [[https://github.com/laravel-frontend-presets|laravel-frontend-presets]], en plus des quelques ui presets fournis par Laravel pour un simple dashboard ou la tall stack ou ... de simples mais jolis dashboards comme [[https://www.creative-tim.com/live/paper-dashboard-laravel|paper-dashboard-laravel]] |
* [[https://laravel.com/docs/5.3|Laravel 5.3]] | * [[https://laravel.com/docs/5.3|Laravel 5.3]] |
</code> | </code> |
| |
| ==== Client side validation ==== |
| |
| === Avec JQuery === |
| |
| Le package [[https://github.com/proengsoft/laravel-jsvalidation|proengsoft/laravel-jsvalidation]] fait la passerelle entre Laravel et "jQuery Validation Plugin" [[https://jqueryvalidation.org/|jqueryvalidation]]. La majorité des règles de validation et ainsi que leurs messages d'erreur sont compatibles, c'est excellent. |
| |
| === Avec Alpine.Js === |
| |
| Rien trouvé. Il y a le [[https://medium.com/@just_turquoise_armadillo_355/javascript-form-validation-with-alpine-js-and-ionide-js-a17b6d23fbf8|micro-framework Ionide]] mais pas compatible avec Laravel, notamment le format des messages d'erreur. |
| === Avec Vue.js === |
| |
| Pas de réponse à ma question [[https://laracasts.com/discuss/channels/vue/validation-vue-package-compatible-with-laravel-validator-rules|Validation VUE package compatible with Laravel Validator Rules]]. |
| |
| Packages à évaluer: |
| * [[https://www.npmjs.com/package/@vuelidate/validators|vuelidate/validators]] |
| * [[https://vuelidate-next.netlify.app/|Vuelidate 2]] with [[https://www.npmjs.com/package/@vuelidate/core|vuelidate/core]] and [[https://www.npmjs.com/package/@vuelidate/validators|vuelidate/validators]] |
| * [[https://vee-validate.logaretm.com/v4/|vee-validate]] |
| * pour inspiration [[https://github.com/RobertGlynWilliams/vee-validate-laravel|vee-validate-laravel]], [[https://github.com/cretueusebiu/vform|cretueusebiu/vform]] |
| * [[https://vee-validate.logaretm.com/v4/guide/global-validators|Global validators]] (Laravel-like syntax) through @vee-validate/rules |
| * [[https://vee-validate.logaretm.com/v4/guide/components/handling-forms|handling-forms]] pour le schéma de validation, les valeurs initiales et les différentes façons de gérer le submit |
| * [[https://vee-validate.logaretm.com/v4/api/use-form#composable-api|Composable API]] |
| * Permet de définir les erreurs initiales au mount avec ''[[https://vee-validate.logaretm.com/v4/guide/composition-api/handling-forms#initial-errors|initialErrors]]'' |
| * [[https://github.com/zhorton34/vuejs-form|zhorton34/vuejs-form]] est inspiré de Laravel :-) |
===== Data, ORM, Eloquent ===== | ===== Data, ORM, Eloquent ===== |
| |
* [[https://laravel-news.com/2015/09/how-to-add-multilingual-support-to-eloquent/|How To Add Multilingual Support to Eloquent]] | * [[https://laravel-news.com/2015/09/how-to-add-multilingual-support-to-eloquent/|How To Add Multilingual Support to Eloquent]] |
* [[https://github.com/menthol/laravel-relationships-examples|All Laravel relationships implemented in a ready to try Laravel skeleton app]] | * [[https://github.com/menthol/laravel-relationships-examples|All Laravel relationships implemented in a ready to try Laravel skeleton app]] |
| |
| ==== Boot & initialize Trait ==== |
| |
| Eloquent peut booter et initialiser les Traits utilisés par les modèles, en utilisant la méthode de nommage **boot<Trait>** and **initialize<Trait>**, |
| |
| https://orkhan.dev/2020/08/17/using-traits-to-boot-and-initialize-eloquent-models/ |
| |
==== Model validation ==== | ==== Model validation ==== |
==== Error catcher ==== | ==== Error catcher ==== |
| |
[[:informatique:php::informatique:error_services|informatique]]/error_services | [[/informatique:error_services|informatique/error_services]] |
| |
Avec [[https://sentry.io|Sentry.io]] : | Avec [[https://sentry.io|Sentry.io]] : |
* [[https://docs.sentry.io/clients/php/integrations/laravel/|https://docs.sentry.io/clients/php/integrations/laravel/]] | * [[https://docs.sentry.io/clients/php/integrations/laravel/|https://docs.sentry.io/clients/php/integrations/laravel/]] |
| |
| ==== PhpDoc ==== |
| |
| Merci à [[https://darkghosthunter.medium.com/|Italo Baeza Cabrera]] pour [[https://darkghosthunter.medium.com/laravel-phpdocs-for-models-everyone-should-have-9fe0d8349525|Laravel: PHPDocs for Models everyone should have]] |
| |
| <code> |
| /** |
| * @mixin \Illuminate\Database\Eloquent\Builder |
| * |
| * @method static \Illuminate\Database\Eloquent\Builder|static query() |
| * @method static static make(array $attributes = []) |
| * @method static static create(array $attributes = []) |
| * @method static static forceCreate(array $attributes) |
| * @method \App\Models\User firstOrNew(array $attributes = [], array $values = []) |
| * @method \App\Models\User firstOrFail($columns = ['*']) |
| * @method \App\Models\User firstOrCreate(array $attributes, array $values = []) |
| * @method \App\Models\User firstOr($columns = ['*'], \Closure $callback = null) |
| * @method \App\Models\User firstWhere($column, $operator = null, $value = null, $boolean = 'and') |
| * @method \App\Models\User updateOrCreate(array $attributes, array $values = []) |
| * @method null|static first($columns = ['*']) |
| * @method static static findOrFail($id, $columns = ['*']) |
| * @method static static findOrNew($id, $columns = ['*']) |
| * @method static null|static find($id, $columns = ['*']) |
| * |
| * @property-read int $id |
| * |
| * @property string $first_name |
| * @property string $last_name |
| * @property \Illuminate\Support\Collection|null $favorite_songs |
| * @property int $stars |
| * |
| * @property-read \Illuminate\Support\Carbon $created_at |
| * @property-read \Illuminate\Support\Carbon $updated_at |
| * @property-read \Illuminate\Support\Carbon $deleted_at |
| * |
| * @property-read string $full_name |
| * |
| * @property-read \App\Models\Avatar $avatar |
| * @property-read \App\Models\Biography|null $biography |
| * @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\Post[] $posts |
| * |
| * @method \Illuminate\Database\Eloquent\Builder|static age(int $age) |
| */ |
| </code> |
| |
==== Wordpress and Laravel ==== | ==== Wordpress and Laravel ==== |
==== Tools ==== | ==== Tools ==== |
| |
| * [[https://underground.works/clockwork/|ClockWork]] a l'air plus puissant que Laravel Debugbar ... |
* [[https://github.com/barryvdh/laravel-debugbar|Laravel Debugbar]] | * [[https://github.com/barryvdh/laravel-debugbar|Laravel Debugbar]] |
| |
* [[https://voltagead.com/the-basics-of-laravel-queues-using-redis-and-horizon/|The basics of Laravel Queues using Redis and Horizon]] | * [[https://voltagead.com/the-basics-of-laravel-queues-using-redis-and-horizon/|The basics of Laravel Queues using Redis and Horizon]] |
* package [[https://github.com/imTigger/laravel-job-status|Laravel Job Status]] add ability to track Job progress, status and result dispatched to Queue | * package [[https://github.com/imTigger/laravel-job-status|Laravel Job Status]] add ability to track Job progress, status and result dispatched to Queue |
| |
| When the queued job is being pulled out from the queue, the CallQueuedListener will check if it’s using the [[https://laravel.com/docs/10.x/events#manually-interacting-with-the-queue|InteractsWithQueue]] trait, and if it is, the framework will inject the underlying “job” instance inside. |
| |
More about [[.laravel:horizon|horizon]]. | More about [[.laravel:horizon|horizon]]. |