使⽤Laravel 8
PHP主流框架打造
RESTful APIRESTful API ⾃我介紹 • 王盛立 • 出版過⼀本 使⽤Laravel 8 PHP主流框架打造RESTful API(iT邦幫忙鐵⼈賽系列書) • 浪浪的事 Side Project https://langlangthing.com/ 今⽇菜單 ⾃我介紹 RESTful API Laravel程式範例說明 延伸補充資料 前後端分離 WEB API RESTful RESTful API 是什麼 Representational state transfer (REST) 表現層狀態轉換 Client Server REQUEST RESPONSE GET https://localhost/api/v1/articles/1 HTTP STATUS : 200 OK HTTP 協定 HTTP VERBS. URL. HTTP STATUS. 14:07:22", "updated_at": "2021-09-08 14:07:22" } } 201 CREATED https://localhost/api/v1/articles Headers Headers Body Body REQUEST RESPONSE JSON Accept : application/json Content-Type0 码力 | 22 页 | 3.41 MB | 1 年前3
Laravel 5.6 中文文档org 1 一、序言 新版特性 Laravel 5.6 在 Laravel 5.5 的基础上继续进行优化,包括日志系统、单机任务调度、模型序列化优化、动态频率限制、广播频道类、API 资源控制器 生成、Eloquent 日期格式化优化、Blade 组件别名、Argon2 密码哈希支持、引入 Collision 扩展包等等等等。此外,所有的前端脚手架代码都已升 级到 Bootstrap 学院提供 Laravel 学院致力于提供优质 Laravel 中文学习资源:http://laravelacademy.org 2 Route::middleware('auth:api', 'throttle:60,1')->group(function () { Route::get('/user', function () { // }); 请求次数,如果 User 模型包含 rate_limit 属性,可以将属性名传递 给 throttle 中间件,以便用于计算最大请求次数计数: Route::middleware('auth:api', 'throttle:rate_limit,1')->group(function () { Route::get('/user', function () { //0 码力 | 377 页 | 14.56 MB | 1 年前3
Laravel 6.0 中文文档Illuminate\Support\Facades\Redis; 本文档由学院君提供 学院君致力于提供优质 Laravel 中文学习资源:https://xueyuanjun.com 6 class RateLimited { /** * 处理队列任务. * * @param mixed $job * @param callable $next * @return mixed __('If you did not receive the email') }},0 码力 | 1442 页 | 14.66 MB | 1 年前3
Laravel 5.3 中文文档........................................................................................ 261 8.4 API 认证(Passport) ..................................................................................... Webpack;“可邮寄”的对象;明确分离 web 和 api 路由;基于闭包的控制台命令;存储上传文件的辅助函数;支持 POPO 和单动作控制 器;以及优化前端脚手架;等等等等。 通知(Notifications) 注:Laracasts 上有关于此特性的免费视频教程。 Laravel Notifications 为我们提供了简单、优雅的 API 用于在不同的发行渠道中发送通知,例如邮 件、SMS、Slack Echo,通过 NPM 安装的全新的 JavaScript 包,将和 Laravel 5.3 一起发布,用于为订阅频 道以及在客户端 JavaScript 应用中监听服务器端事件提供了简单、优美的 API,Echo 包含对 Pusher 和 Socket.io 的支持: Echo.channel('orders.' + orderId) .listen('ShippingStatusUpdated'0 码力 | 691 页 | 9.37 MB | 1 年前3
Learning LaravelSharing data to all views 24 Using View::share 24 Using View::composer 24 Closure-based composer 24 Class-based composer 24 Execute arbitrary PHP code 25 Chapter 6: Cashier 26 Remarks 26 Examples 26 routing behaviour in Laravel 5.2.31 + 28 Syntax 28 Parameters 28 Remarks 28 Examples 28 Adding api-routes with other middleware and keep default web middleware 28 Chapter 8: Collections 30 Syntax HelpersServiceProvider.php 48 Use 49 Chapter 15: CustomException class in Laravel 50 Introduction 50 Examples 50 CustomException class in laravel 50 Chapter 16: Database 51 Examples 51 Multiple database0 码力 | 216 页 | 1.58 MB | 1 年前3
Laravel 5.0 Documentation
Introduction ii. Explanation iii. Practical Usage iv. Creating Facades v. Mocking Facades vi. Facade Class Reference v. Request Lifecycle i. Introduction ii. Lifecycle Overview iii. Focus On Service Providers using the new app:name Artisan command. Controllers, middleware, and requests (a new type of class in Laravel 5.0) are now grouped under the app/Http directory, as they are all classes related to application. Instead of a single, flat file of route filters, all middleware are now broken into their own class files. A new app/Providers directory replaces the app/start files from previous versions of Laravel0 码力 | 242 页 | 1.44 MB | 1 年前3
Laravel 5.2 中文文档中间件组允许你通过单个方便的键来对相关路由中间件进行分组,从而为某个路由一次指 定多个中间件。例如,在同一个应用中构建 Web UI 或 API 时这一特性很有用,你可以 将 session 和 csrf 路由分组到一个 web 组,或者将访问频率限制分组到 api 中。 实际上,默认的 Laravel 5.2 应用结构采用的正是这个方法。例如,在默认 的 App\Http\Kernel.php 文件中你会看到如下内容: \App\Http\Middleware\EncryptCookies::class, \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class, \Illuminate\Session\Middleware\StartSession::class, \Illuminate\View\ rorsFromSession::class, \App\Http\Middleware\VerifyCsrfToken::class, ], 本文档由 Laravel 学院(LaravelAcademy.org)提供 Laravel 学院致力于提供优质 Laravel 中文学习资源 3 'api' => [ 'throttle:600 码力 | 377 页 | 4.56 MB | 1 年前3
Laravel 5.1 中文文档创建一个 RoleMiddleware 来接收角 色名称作为额外参数: class RoleMiddleware { /** * 运行请求过滤器. * * @param \Illuminate\Http\Request $request App\Http\Middleware; use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Ba seVerifier; class VerifyCsrfToken extends BaseVerifier { /** *从 CSRF 验证中排除的 URL * * @var array 中间件中,我们只允许提供的 age 大于 200 的访问路由,否则,我们将用户重定向到主页: class OldMiddleware { /** * 返回请求过滤器 * * @param \Illuminate\Http\Request $request0 码力 | 307 页 | 3.46 MB | 1 年前3
The Laravel Handbook
form to add dogs to the table. To do so, first we create a Dog model. What’s a model? A model is a class that allows us to interact with data stored in the database. Each model represents a specific table the class inclues some classes under a “Eloquent” folder. Eloquent is an ORM (object-relational mapper), a tool that basically lets us interact with a database using a (PHP, in this case) class. The Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; class Dog extends Model { use HasFactory; protected $fillable = ['name']; } A model0 码力 | 111 页 | 14.25 MB | 1 年前3
Laravel 3.2 Documentation................................................................................. 41 Bundles & Class Loading ......................................................................................... ........................................................................................... 45 Class Auto Loading .................................................................................... ................................................................................ 48 The Logger Class..................................................................................................0 码力 | 139 页 | 1.13 MB | 1 年前3
共 18 条
- 1
- 2













