/easy-api

Easy Way to integrate API in you laravel application.

Primary LanguagePHP

Easy Api

Easy Way to integrate API in you laravel application.

Installation Guide


Install Package using Composer.

composer require flutterbuddy1/easy-api

Paste the code below given.

Use this to your route/api.php

use Flutterbuddy1\EasyApi\EasyApi;

And add this inside you api middleware in route/api.php

EasyApi::api();

That's It your API's is ready to go 🚀


API's Docs


Get Data API

Send GET Request in this api.

http://YOUR_APPLICATION_URL/api/{TABLE_NAME}

Example:

http://localhost:8000/api/posts
  • Include Table
http://YOUR_APPLICATION_URL/api/{TABLE_NAME}?include={OTHER_TABLE_NAME}

Example:

http://localhost:8000/api/posts?include=categories,users

Get Data By Id API

Send GET Request in this api.

http://YOUR_APPLICATION_URL/api/{TABLE_NAME}/{ID}

Example:

http://localhost:8000/api/posts/3
  • Include Table
http://YOUR_APPLICATION_URL/api/{TABLE_NAME}/{ID}?include={OTHER_TABLE_NAME}

Example:

http://localhost:8000/api/posts/3?include=categories,users

Post Data API

Send POST Request in this api.

http://YOUR_APPLICATION_URL/api/{TABLE_NAME}

Example:

http://localhost:8000/api/posts

Post Data in JSON :

{
    "title:"Some Title",
    "content":"Some Content",
    "category":"YOUR CATEGORY ID",
    "user":"YOUR USER ID",
}

Update Data API

Send PUT Request in this api.

http://YOUR_APPLICATION_URL/api/update/{TABLE_NAME}

Example:

http://localhost:8000/api/update/posts

Post Data in JSON :

{
    "title:"UPDATED TITLE",
    "content":"UPDATED CONTENT",
}

Delete Data API

Send DELETE Request in this api.

http://YOUR_APPLICATION_URL/api/delete/{TABLE_NAME}/{ID}

Example: :
http://localhost:8000/api/delete/posts/3

Contribute for Adding New Features

Created With ♥ By FlutterBuddy