Coder Social home page Coder Social logo

phprest.api's Introduction

Simple PHP REST framework

No-frills REST api framework written in PHP. Consists of Model-Controller which can easily be extended for MVC if desired. Take a look at the sample todo list implemented as an in-memory API to help you implement your own REST API.

Basic Usage

Call REST via

http://localhost/phprest.api/index.php/foo/bar

or if you're using the provided .htaccess

http://localhost/phprest.api/foo/bar

where

foo = controller, bar = action

Create FooController class in controllers/foo.php with function barAction()

Optional parameters can be passed in the URL itself

http://localhost/phprest.api/foo/bar/param1/param2/param3

Where you can access [param1, param2, param3] as an incoming array in function barAction($uri_parts)

REST like Usage

In this usage we can omit action and instead rely in REST verbs GET, POST, PUT and DELETE for CRUD like actions.

$ curl -X bar http://localhost/phprest.api/foo

where

foo = controller, bar = GET, POST, PUT or DELETE

Create FooController class in controllers/foo.php with function barAction(), where bar is in lowercase (e.g: get not GET)

What's included

  • docs - Documentation about testing the sample todo REST API
  • models - Where you would put any data Models. This needs to be loaded via Controller
  • controllers - main.php is the default controller. See other controllers as examples.
  • system - Base classes. You wouldn't need to touch these unless your extending the system

License

Read License

phprest.api's People

Contributors

geekaholic avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.