doutan1857 2013-04-03 21:14
浏览 46
已采纳

Laravel 3 - RESTful API

How do I create the Routes for a RESTful API in Laravel 3?

I want to use GET, PUT, POST and DELETE in order to create an API.

I want all Routes to be prefixed with /v1/

So, I can do this:

http://api.example.com/v1/controller/method/parameter and just create the relevant controllers to check for Auth and perform actions.

  • 写回答

2条回答 默认 最新

  • douhuan3420 2013-04-03 23:05
    关注

    I would suggest you using laravel 4 instead of laravel 3. Laravel 4 is really good at creating RESTful APIs and you can get started pretty fast. Here is a how to:

    http://net.tutsplus.com/tutorials/php/laravel-4-a-start-at-a-restful-api/

    Also watch this video if you are new to APIs

    https://blog.apigee.com/detail/restful_api_design

    What they suggest is passing parameters like so: api.test.com/v1/dogs?state=running

    I recently started of with developing a restful API service myself using laravel 4 and it is going pretty well so far. Also laravel 4 is said to release in May.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥35 平滑拟合曲线该如何生成
  • ¥100 c语言,请帮蒟蒻写一个题的范例作参考
  • ¥15 名为“Product”的列已属于此 DataTable
  • ¥15 安卓adb backup备份应用数据失败
  • ¥15 eclipse运行项目时遇到的问题
  • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
  • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
  • ¥15 自己瞎改改,结果现在又运行不了了
  • ¥15 链式存储应该如何解决
  • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站