使⽤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 中文文档授权资源 & viewAny 字符串 & 数组辅助函数 影响中等 认证 RegisterController 不再支持 Carbon 1.x 数据库 Capsule::table 方法 Eloquent 数组化 & toArray Eloquent BelongsTo::update 方法 Eloquent 主键类型 本地化 Lang::trans 需要在 .env 文件中更新这个环境变量的名称。 数据库 Capsule table 方法 影响级别:中等 注:此更新只会影响使用了 illuminate/database 依赖 包的非 Laravel 应用。 Illuminate\Database\Capsule\Manager 类的 table 方法签名被 更新为接收数据表别名作为第二个参数,如果你在 Laravel 应用之 fluent query builder instance. * * @param \Closure|\Illuminate\Database\Query\Builde r|string $table * @param string|null $as * @param string|null $connection * @return \Illuminate\Database\Query\Builder0 码力 | 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 LaravelLaravel #laravel Table of Contents About 1 Chapter 1: Getting started with Laravel 2 Remarks 2 Laravel StackOverflow Slack Community 2 Featured Tutorial 2 Contribution Guidelines 2 Contribution 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 Configuration 168 Basic Usage - Facade 168 Basic Usage - Dependency Injection 169 Socialite for API - Stateless 169 Chapter 58: Sparkpost integration with Laravel 5.4 171 Introduction 171 Examples0 码力 | 216 页 | 1.58 MB | 1 年前3
Laravel 5.0 Documentation
i. Introduction ii. Defining Middleware iii. Registering Middleware iv. Terminable Middleware Table of Contents iii. Controllers i. Introduction ii. Basic Controllers iii. Controller Middleware simple corresponding views, which are located at resources/views/auth . In addition, a "users" table migration has been included with the framework. Including these simple resources allows rapid development integration with local, Amazon S3, and Rackspace cloud storage - all with one, unified and elegant API! Storing a file in Amazon S3 is now as simple as: Storage::put('file.txt', 'contents'); For more0 码力 | 242 页 | 1.44 MB | 1 年前3
Laravel 5.2 中文文档中间件组允许你通过单个方便的键来对相关路由中间件进行分组,从而为某个路由一次指 定多个中间件。例如,在同一个应用中构建 Web UI 或 API 时这一特性很有用,你可以 将 session 和 csrf 路由分组到一个 web 组,或者将访问频率限制分组到 api 中。 实际上,默认的 Laravel 5.2 应用结构采用的正是这个方法。例如,在默认 的 App\Http\Kernel.php 文件中你会看到如下内容: ], 本文档由 Laravel 学院(LaravelAcademy.org)提供 Laravel 学院致力于提供优质 Laravel 中文学习资源 3 'api' => [ 'throttle:60,1', ], ]; 然后,web 组像这样分配给路由: Route::group(['middleware' => 一个新的访问频率限制中间件已经被内置到框架中,从而允许你轻松限制给定 IP 地址在 指定时间内对某个路由发起请求的数目。例如,要限制某个 IP 地址每分钟只能访问某个 路由 60 次,你可以这么做: Route::get('/api/users', ['middleware' => 'throttle:60,1', function () { // }]); 数组输入验证 在 Laravel 5.2 可0 码力 | 377 页 | 4.56 MB | 1 年前3
Laravel 5.1 中文文档$request->file('photo')->move($destinationPath, $fileName); 2.3.5 其它文件方法 UploadedFile 实例中很有很多其它方法,查看该类的 API 了解更多相关方法。 HTTP 响应 1、基本响应 所有路由和控制器都会返回某种被发送到用户浏览器的响应,Laravel 提供了多种不同的方 式来返回响应,最基本的响应就是从路由或控制器返回一个简单的字符串: $status) ->header('Content-Type', $value);}); 注意:查看完整的 Response 方法列表,请移步相应的 API 文档以及 Symfony AP 文档 1.1 添加响应头 大部分响应方法都是可以链式调用的,从而使得可以平滑的构建响应。例如,可以使用 header 方法来添加一系列响应头: return Artisan 命令 app:name 来修改该 命名空间。 app 目录下包含多个子目录,如 Console、Http、Providers 等。Console 和 Http 目录提供 了进入应用核心的 API,HTTP 协议和 CLI 是和应用进行交互的两种机制,但实际上并不包 含应用逻辑。换句话说,它们只是两个向应用发布命令的方式。Console 目录包含了所有的 Artisan 命令,Http 目录包含了控制器、过滤器和请求等。0 码力 | 307 页 | 3.46 MB | 1 年前3
The Laravel Handbook
1 Table of Contents Preface The Laravel Handbook Conclusion 2 Preface The Laravel Handbook follows the 80/20 rule: learn in 20% of the time the 80% of a topic. In particular, the goal is to get bootcamp.dev. You can reach me on Twitter @flaviocopes. Enjoy! 3 The Laravel Handbook 0. Table of contents 0. Table of contents 1. Introduction to Laravel 2. Getting started 3. Blade 4. Dynamic routes will use to create the database table(s) we need to use: php artisan make:migration initial_table_creation 23 This command created the 2023_05_11_080724_initial_table_creation.php file (the date0 码力 | 111 页 | 14.25 MB | 1 年前3
Laravel 3.2 Documentationcreative experience that you enjoy, not something that is painful. Enjoy the fresh air. ii TABLE OF CONTENTS Laravel Documentation ............................................................. ........................................................................................... 82 Table Joins ........................................................................................... ........................................................................... 113 Authentication Table .................................................................................................0 码力 | 139 页 | 1.13 MB | 1 年前3
共 19 条
- 1
- 2













