Tutorials for api
-
Course: Re-creating Booking.com API with Laravel and PHPUnit
The best way to learn to code is to create real projects. In this long course, I decided to simulate...
-
Course: Flutter Mobile App with Laravel API
These days, Laravel is used not only for web applications but also as a back-end API for mobile apps...
-
Course: How to Create Laravel API
Everyone now is searching for API developers, just look at the Laravel jobs or freelance offers. So...
-
October 07, 2021 · 41:03
Video: Live-Coding: Laravel CRUD + Vue.js 3 Composition API
-
April 27, 2022 · 21:01
Video: From Laravel Blade to Vue.js 3: Live-Coding Demo
-
July 13, 2021 · 12:17
Video: Laravel: Create Public API with Cache and Rate Limits
-
· Updated Sep 2022 · 20 mins, 3867 words
Article: Laravel 8 + Vue.js 3 CRUD with Composition API
-
· 19 mins, 3636 words · premium
Article: React.js + Laravel API CRUD: Step-by-Step Practical Example
-
· Updated Aug 2022 · 10 mins, 1906 words
Article: Laravel API Errors and Exceptions: How to Return Responses
-
Random Quick Laravel Tip:
API VersioningWhen to version?
If you are working on a project that may have multi-release in the future or your endpoints have a breaking change like a change in the format of the response data, and you want to ensure that the API version remains functional when changes are made to the code.
Change The Default Route Files
The first step is to change the route map in the
App\Providers\RouteServiceProvider
file, so let's get started:Laravel 8 and above:
Add a 'ApiNamespace' property
/*** @var string**/protected string $ApiNamespace = 'App\Http\Controllers\Api';Inside the method boot, add the following code:
$this->routes(function () {Route::prefix('api/v1')->middleware('api')->namespace($this->ApiNamespace.'\\V1')->group(base_path('routes/API/v1.php'));}//for v2Route::prefix('api/v2')->middleware('api')->namespace($this->ApiNamespace.'\\V2')->group(base_path('routes/API/v2.php'));});Laravel 7 and below:
Add a 'ApiNamespace' property
/*** @var string**/protected string $ApiNamespace = 'App\Http\Controllers\Api';Inside the method map, add the following code:
// remove this $this->mapApiRoutes();$this->mapApiV1Routes();$this->mapApiV2Routes();And add these methods:
protected function mapApiV1Routes(){Route::prefix('api/v1')->middleware('api')->namespace($this->ApiNamespace.'\\V1')->group(base_path('routes/Api/v1.php'));}protected function mapApiV2Routes(){Route::prefix('api/v2')->middleware('api')->namespace($this->ApiNamespace.'\\V2')->group(base_path('routes/Api/v2.php'));}Controller Folder Versioning
Controllers└── Api├── V1│ └──AuthController.php└── V2└──AuthController.phpRoute File Versioning
routes└── Api│ └── v1.php│ └── v2.php└── web.phpTip given by Feras Elsharif
-
Package: DarkaOnLine/L5-Swagger
OpenApi or Swagger Specification for your Laravel project made easy
-
Package: binarcode/laravel-restify
The first fully customizable Laravel JSON:API builder. "CRUD" and protect your resources with 0 (zero) extra line of code.
-
Package: AndreasElia/laravel-api-to-postman
This package allows you to automatically generate a Postman collection based on your API routes. It also provides basic configuration and support for bearer auth tokens and basic auth for routes behind an auth middleware.
-
June 27, 2022 · 10:17
Video: Junior Code Review: Laravel API Controller - 8 Tips for Improvement
-
February 28, 2021 · 9:33
Video: Junior Code Review: Simple Laravel API - in 5 Different Ways
-
July 05, 2021 · 8:32
Video: Laravel API 404 Error: Customize Exception Message
-
December 29, 2021 · 8:29
Video: Laravel Orion: Build API With A Few Lines of Code
-
November 08, 2021 · 8:11
Video: Laravel API and Repositories: 3 Tips from Code Review
-
September 19, 2021 · 7:08
Video: Laravel API Resources: 3 More Complex Examples
-
July 10, 2022 · 6:44
Video: Laravel API Resource - Reusable with Conditions For Fields
-
· 3 mins, 464 words
Article: Eloquent API Response: 4 Ways to Hide Specific DB Fields
-
· 3 mins, 463 words
Article: Laravel: API Error Shows HTML and not JSON - How To Fix
-
· 2 mins, 346 words
Article: Laravel API: Override 404 Error Message in Route Model Binding
-
· 2 mins, 302 words
Article: Laravel API 404 Response: Return JSON Instead of Webpage Error
-
· 1 min, 126 words
Article: Resource Controllers for API: How to Remove create/edit methods?
-
Package: tailflow/laravel-orion
Laravel Orion allows you to build a fully featured REST API based on your Eloquent models and relationships with simplicity of Laravel as you love it.