Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/germondai/php-api

PHP RESTful API with Doctrine, Entities, JWT and Pre-done Auth!
https://github.com/germondai/php-api

api crud db dbal doctrine entities jwt media migrations mysql orm php rest rest-api storage template

Last synced: about 1 month ago
JSON representation

PHP RESTful API with Doctrine, Entities, JWT and Pre-done Auth!

Awesome Lists containing this project

README

        






PHP RESTful API 

**PHP RESTful API** with **Doctrine** integration. Own **Api** & **Entity Controller** that handles routing of **Model/Action** and **Entity** with **CRUD options** based on **Request Method**. Doctrine **Console**, **Entities** and **Migrations** to create flawless **ORM Schemas**. Custom useful **Utils** like **Token** that manages **JSON Web Tokens** (JWT). Pre-done **Auth Model**, **User Entity** connected with **Media Entity** by **OneToMany Relation** to keep track of **Author** of **uploaded** media **files** (**optimize**, **resize** and **image format/type change** included). Easy **configuration** and safe **.env** variables.

## ⚡️ Features

**Overview**

- Own REST API System
- Routing
- Auth
- CRUD
- Media
- Upload
- Optimize
- Resize
- Quality
- Format
- Doctrine
- ORM
- DBAL
- Entities
- Migrations
- Annotations
- Custom Utils
- Helper
- Database
- Doctrine
- JSON Web Tokens (JWT)
- Nette
- Database Explorer
- Tracy
- Environment (.env)

## 🧬 Structure

**app/** - App's Main Code (Controller, Entity, Model)\
**bin/** - Console for Doctrine\
**migrations/** - Doctrine DB Migrations\
**public/** - Accessible from Outside (Routing, Media)\
**src/** - Developer Source Files (Assets, Includes, Utils)\
**temp/** - Storage for Temporary Files and Logs

## 🧠 Technologies

- PHP
- Doctrine
- Nette DB
- JSON Web Tokens (JWT)

## 🛠️ Installation Instructions

Requirements

- 👨‍💻 Composer

**Install dependencies**

```bash
composer install
```

**Setup .env**

- Database Credentials
- JWT Secret and Algorithm

```bash
# to dupe example.env as .env
cp example.env .env
```

## 📝 Entity Guide

Entity CRUD operations depends on Request Methods\
Entity Schema returns tables / table with columns

### Routes

Operations: `/[entity]/[id]`

- GET - Read
- POST - Create
- PUT - Replace
- PATCH - Update
- DELETE - Delete
- OPTIONS - Preflight (always return 200)

Schema: `/schema/[entity]`

## 📚 Doctrine Guide

The Doctrine console is in "_bin/console_"\
EntityManager config location "_src/Utils/Doctrine.php_"\
Base migrations config, which is in root "_migrations.php_"\
And migration files are stored in "_migrations/_"

### Console

```bash
# To run doctrine console
php bin/console ...

# if you need commands list
php bin/console list
```

---


Made with ❤️ by
@germondai