Code Monkey home page Code Monkey logo

laravel-restapi's Introduction

Laravel REST API

This is a basic CRUD API made with the latest version of Laravel (9.x), a popular framework made on top of PHP. The project makes use of Service Layer-Repository Pattern in order to keep the code clean and organized, custom authentication, and authorization with the help of Spatie's permission package.

Basic Usage

Follow the steps below in order to start using this application.

Create Database

$ php artisan db:create

Define database schema

$ php artisan migrate

Populate the database with data

$php artisan db:seed

Run the application

php artisan serve

Authentication credentials

Email: [email protected]
Password: password

Test Endpoints

Use the following endpoints in order to test the application.

Authentication

User Register: POST localhost:8000/api/register
User Login: POST localhost:8000/api/login
User Logout: POST localhost:8000/api/login

Authorization

List Roles: GET localhost:8000/api/roles
Get Role: GET localhost:8000/api/roles/3
Add Role: POST localhost:8000/api/roles
Update Role: PUT localhost:8000/api/roles/3
Delete Role: DELETE localhost:8000/api/roles/3
Search Keyword: GET localhost:8000/api/roles?search=lorem

Articles

List Articles: GET localhost:8000/api/articles
Get Article: GET localhost:8000/api/articles/3
Add Article: POST localhost:8000/api/articles
Update Article: PUT localhost:8000/api/articles/3
Delete Article: DELETE localhost:8000/api/articles/3
Search Keyword: GET localhost:8000/api/articles?search=lorem

Users

List Users: GET localhost:8000/api/users
Get User: GET localhost:8000/api/users/3
Update User: PUT localhost:8000/api/users/3
Delete User: DELETE localhost:8000/api/users/3
Search Keyword: GET localhost:8000/api/users?search=lorem

Node: If you're using Postman to test this API, don't forget to add HTTP Header key "Accept" with the value "application/json".

laravel-restapi's People

Contributors

mentorg 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.