https://github.com/app-generator/api-server-laravel
Laravel API Server - Open-Source API Server | AppSeed
https://github.com/app-generator/api-server-laravel
api-rest appseed appseed-sample laravel
Last synced: 7 months ago
JSON representation
Laravel API Server - Open-Source API Server | AppSeed
- Host: GitHub
- URL: https://github.com/app-generator/api-server-laravel
- Owner: app-generator
- License: other
- Created: 2021-07-03T07:15:52.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-11-16T19:39:34.000Z (almost 4 years ago)
- Last Synced: 2025-03-11T05:55:14.019Z (7 months ago)
- Topics: api-rest, appseed, appseed-sample, laravel
- Language: PHP
- Homepage: https://appseed.us/boilerplate-code/laravel-boilerplate
- Size: 142 KB
- Stars: 10
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
README
# [Laravel API Server](https://appseed.us/boilerplate-code/laravel-boilerplate)
Simple Laravel API Server with JWT authentication, and **SQLite** persistence - Provided by **AppSeed** [App Generator](https://appseed.us) and [UPDIVISION](https://updivision.com/?ref=appseed).
> Features:
- [API Definition](https://docs.appseed.us/boilerplate-code/api-unified-definition) - the unified API structure implemented by this server
- Simple, intuitive codebase - can be extended with ease.
- **Stack**: PHP 7.4+ / Laravel / Doctrine
- JWT Authentication
> Can be used with other [React Starters](https://appseed.us/apps/react) for a complete **Full-Stack** experience:
| [React Node JS Berry](https://appseed.us/product/react-node-js-berry-dashboard) | [React Node Soft Dashboard](https://appseed.us/product/node-js-react-soft-dashboard) | [React Node Datta Able](https://github.com/app-generator/react-datta-able) |
| --- | --- | --- |
| [](https://appseed.us/product/react-node-js-berry-dashboard) | [](https://appseed.us/product/node-js-react-soft-dashboard) | [](https://github.com/app-generator/react-datta-able)

## Requirements
- PHP 7.4+
- Extensions (check the #Troubleshooting section for installation info)
- `php-xml`
- `php7.4-sqlite`
## How to use the code
**Step #1** - Clone the project
```bash
$ git clone https://github.com/app-generator/api-server-laravel.git
$ cd api-server-laravel
```**Step #2** - Install dependencies
```bash
$ composer install
$ cp .env.example .env
$ php artisan key:generate
```**Step #3** - Generate a `secret` key used by JWT Authentication Flow
```
$ php artisan jwt:secret
```**Step #4** - Set up the database
```bash
$ touch database/database.sqlite
$ php artisan migrate
```**Step #5** - Start the server
```bash
$ php -S localhost:5000 server.php
```
## Troubleshooting
To have a successful compilation of this product, make sure you have the following PHP extensions installed and enabled:
- `php-xml` - required by Php-Unit
- `php7.4-sqlite` - The SQLite driver required by Laravel ORM```bash
$ # Php XML - required by Php Unit
$ sudo apt install php-xml php-cli php-mbstring php7.4-sqlite
```
## Codebase Structure
```bash
< ROOT >
|
|-- app/ # Implements APP Bussiness Logic
|-- config/ # Configuration
|-- public/ # Public folder
|-- routes/ # Application ROutes
|-- tests/ # Tests
|
|-- server.php # API Entry Point
|-- .env # Specify the ENV variables
|
|-- ************************************************************************
```
## API
For a fast set up, use this POSTMAN file: [api_sample]([api_sample](https://github.com/app-generator/api-unified-definition/blob/main/api.postman_collection.json))
> **Register** - `api/users/register`
```
POST api/users/register
Content-Type: application/json{
"username":"test",
"password":"pass",
"email":"test@appseed.us"
}
```
> **Login** - `api/users/login`
```
POST /api/users/login
Content-Type: application/json{
"password":"pass",
"email":"test@appseed.us"
}
```
> **Logout** - `api/users/logout`
```
POST api/users/logout
Content-Type: application/json
authorization: JWT_TOKEN (returned by Login request){
"token":"JWT_TOKEN"
}
```
---
**[Laravel API Server](https://appseed.us/boilerplate-code/laravel-boilerplate)** - provided by AppSeed [App Generator](https://appseed.us)