Skip to content

asifzcpe/table2api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

table-to-api generator

table2api is a laravel package that creates rest api for a certain table. It generates scaffolding for rest api.

  • It generates controller,model,request and route for a certain table to work like rest api

Installing table-to-api

The recommended way to install table-to-api is through Composer.

composer require asifzcpe/table-to-api

Setting up the package in laravel project

  1. Run following artisan command shipped with this package
php artisan table2api:generate YOUR_TABLE_NAME

if table exists in database it generates following scaffolding:

Image of table-to-api

  1. Inserting api namespace in composer.json file like the following:
 "psr-4": {
     "App\\": "app/",
     "Api\\V1\\":"api/v1/"
  },
  1. Run following command to autoload
composer dumpautoload
php artisan cache:clear
php artisan clear-compiled
  1. Run following command to see generated api routes
  php artisan route:list

and it will show like this (users table in my case) Image of route lists

It is done. Now, you can hit the urls to get json data as rest api

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages