Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Lumenで堅牢なAPIを設計する。

 Lumenで堅牢なAPIを設計する。

PHPerkaigi2018のLTで発表した内容です。
https://phperkaigi.jp/2018/proposal/c4c6998a-6433-4c5b-aa82-d13d4a03a023

Futoshi Endo

March 10, 2018
Tweet

More Decks by Futoshi Endo

Other Decks in Technology

Transcript

  1. CPPUTUSBQBQQQIQʹొ࿥͢Δɻ $app->routeMiddleware([ 'security' => App\Http\Middleware\SecurityHeaders::class, ]); SPVUFTXFCQIQͰݺͼग़͢ɻ $router->group(['prefix' => 'api',

    'middleware'=>'security'], function() use ($router){ $router->get('hoges', ['uses' => 'HogesController@showAllHoges']); }); 08"414FDVSF)FBEFSTͷઃఆ
  2. 5ISPUUMFΛ࢖ͬͨΞΫηε੍ݶͷઃఆ 3PVUF XFCQIQ Ͱࢦఆ͢Δɻ $curl localhost:8010 {"status":429,"message":"Too Many Attempts."} ઃఆ਺Ҏ্ʹϦΫΤετ͢ΔͱͱΤϥʔϝοηʔδΛฦ͢

    $router->group(['middleware' => 'throttle:3,1'], function () use ($router) { $router->get('/', function () use ($router) { return view('index'); }); });