使⽤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 中文文档Laravel Vapor Laravel 6.0 提供了对 Laravel Vapor 的兼容,这是一个针对 Laravel 应用的自动扩容无服务器部署平台。Vapor 对在 AWS Lambda 上 管理 Laravel 应用以及与 SQS 队列、数据库、Redis 集群、网络、 CloudFront CDN 进行交互的复杂性进行了抽象。 通过 Ignition 优化异常 本文档由学院君提供 记住,缺陷报告被创建是为了其他人遇到同样问题的时候能够和你一 起合作解决它,不要寄期望于缺陷会自动解决抑或有人跳出来修复 它,创建缺陷报告是为了帮你自己和别人走上修复问题之路。 Laravel 源码通过 Github 进行管理,每一个 Laravel 项目都有其对 应的代码库: Laravel Application Laravel Art Laravel Documentation Laravel 扩展 PHP Tokenizer 扩展 PHP XML 扩展 满足以上需求之后,就可以开始安装 Laravel 了。 安装 Laravel Laravel 使用 Composer 管理依赖,所以,安装之前确保已经在机器 上安装了 Composer(如果尚未安装的话参考这份文档去安装吧)。 通过 Laravel 安装器 首先,我们可以通过 Laravel 安装器安装 Laravel,在此之前,需要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
Laravel 5.2 中文文档登录带来麻烦。 我们对此进行了改进,在 Laravel 5.2 中,你可以定义多个认证驱动,还有多个认证模型 以及用户表,并且可以独立控制其认证处理(登录、注册、密码重置)。例如,如果你的 应用包含一个后台管理员用户表和一个前台学生用户表,现在你可以使用 Auth 门面来实现 后台用户和学生用户的独立登录而不相互影响。 认证脚手架 通过多认证驱动,Laravel 可以轻松处理后台用户认证;此外,Laravel 中间件组允许你通过单个方便的键来对相关路由中间件进行分组,从而为某个路由一次指 定多个中间件。例如,在同一个应用中构建 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' =>0 码力 | 377 页 | 4.56 MB | 1 年前3
Laravel 5.1 中文文档记住,缺陷报告被创建是为了其他人遇到同样问题的时候能够和你一起合作解决它,不要寄 期望于缺陷会自动解决抑或有人跳出来修复它,创建缺陷报告是为了帮你你自己和别人走上 修复问题之路。 Laravel 源码通过 Github 进行管理,每一个 Laravel 项目都有其对应的代码库: Laravel Framework Laravel Application 本文档由 Laravel 学院(LaravelAcademy 扩展:OpenSSL PHP 扩展:PDO PHP 扩展:Mbstring PHP 扩展:Tokenizer 1.2 安装 Laravel Laravel 使用 Composer 管理依赖,因此,使用 Laravel 之前,确保机器上已经安装 Composer。 1.2.1 通过 Laravel 安装器 首先,通过 Composer 安装 Laravel 安装器: composer 致力于将整个 PHP 开发体验变得让人愉悦,包括本地开发环境。 本文档由 Laravel 学院(LaravelAcademy.org)提供 13 Vagrant 提供了一个便捷的方式来管理和设置虚拟机。Laravel Homestead 是一个官方的、预 安装好的 Vagrant 盒子,该盒子提供了一流的开发环境,有了它,我们不再需要在本地环境 安装 PHP、HHVM、web 服务器0 码力 | 307 页 | 3.46 MB | 1 年前3
Learning Laravelrouting 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 Examples 'driver' => 'session', 'provider' => 'users', ], 'api' => [ 'driver' => 'token', 'provider' => 'users', ],0 码力 | 216 页 | 1.58 MB | 1 年前3
Laravel 5.0 Documentation
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 more Cashier brings numerous bug fixes, multi-currency support, and compatibility with the latest Stripe API. The Artisan queue:work command now supports a --daemon option to start a worker in "daemon mode" workers can be found in the queue documentation. Laravel 4.2 introduces new Mailgun and Mandrill API drivers for the Mail functions. For many applications, this provides a faster and more reliable0 码力 | 242 页 | 1.44 MB | 1 年前3
《Slides Dev Web》 06. HTTP & AJAX
images/cookies (ex: GIF9) – Applets, Flash, ActiveX, … – XHR : XML HTTP Request (IE5, 1999 pour OWA) – Fetch API • Pas obligatoire d’avoir du JS, XML ni d’être asynchrone ! AJAX • XHR est devenue la méthode standard parseJSON('{"nom":"Berger"}'); alert(obj.nom); Fetch API • Le successeur d’XHR est fetch22 : Exemple23 • Fetch a un polyfill pour les navigateurs ne le supportant pas • L’API Fetch est native et plus simple d’utilisation then(function(json) { console.log(json); }) .catch(function(error) { console.error("erreur", error) }) • L’API fetch est native et utilise les promesses24 plutôt que les callbacks Traitement d’erreurs • Utiliser0 码力 | 11 页 | 91.09 KB | 1 年前3
《Slides Dev Web》 09. Services Web
distribuées3 pour l’entreprise – Mashups4 d’applications web (exemples5) – Applications Facebook, API Google6 – IFTTT7 • Consommer un service web ≠ Créer un service web SOAP • AVANT : Simple Object états suivants sont documentés dans la réponse () SOAP vs REST • webservice : exposer son API en REST ou SOAP ? • SOAP (WS-*) – hérité du monde de l’entreprise – plus de code pour manipuler la Google28, Yahoo29, Flickr30, Twitter31, … – APIary32 : Aide au design d’une API REST – Tests : Postman, Hoppscotch33, Ping-API34, autres35 • GraphQL36 – est destiné à devenir la prochaine évolution des0 码力 | 6 页 | 47.90 KB | 1 年前3
共 18 条
- 1
- 2













