Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/germondai/php-framework
PHP Full-Stack MVC Framework - Doctrine, Vite, ...
https://github.com/germondai/php-framework
api blade crud db doctrine entities framework fullstack jwt migrations mvc mysql nette orm php rest tailwindcss template ts vite
Last synced: 3 months ago
JSON representation
PHP Full-Stack MVC Framework - Doctrine, Vite, ...
- Host: GitHub
- URL: https://github.com/germondai/php-framework
- Owner: germondai
- License: mit
- Created: 2024-07-01T12:34:54.000Z (6 months ago)
- Default Branch: dev
- Last Pushed: 2024-07-20T21:48:32.000Z (5 months ago)
- Last Synced: 2024-09-30T13:55:03.652Z (3 months ago)
- Topics: api, blade, crud, db, doctrine, entities, framework, fullstack, jwt, migrations, mvc, mysql, nette, orm, php, rest, tailwindcss, template, ts, vite
- Language: PHP
- Homepage: https://germondai.com
- Size: 873 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
PHP Full-Stack Frameworkย
**PHP Full-Stack Framework** offering both **front** and **back** - **end** options to run **simultaneously**!\
Includes a **RESTful API** and **Model-View-Controller** (MVC) system with integrated **Doctrine** and **Vite**.**Controllers** for **Client** and **Api** to render views and routes as needed. Usage of **blade.php templating engine** with live HMR **Vite** server for **asset bundling** (includes asset mapper for production builds).
Back-end **Api** with **Model** & **Entity Controller** that handles routing of **Model/Action** and **Entity CRUD operations** 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
- MVC System
- Config, Bootstrap, Router
- Preferred mode (api/client)
- Front-end
- Vite (js, ts, css, scss, tailwind)
- Blade (Views, Components, Layouts)
- Back-end API
- RESTful Entities (EntityController)
- CRUD
- Media
- Upload
- Optimize
- Resize
- Quality
- Format
- Models (ModelController)
- Auth
- Doctrine (DBAL, ORM)
- Entities
- Migrations
- Custom Utils
- Helpers
- Helper
- Page Helper
- Database
- Doctrine
- JSON Web Tokens (JWT)
- Nette
- Database Explorer
- Tracy
- Environment (.env)
- Prettier & ESLint
- .htaccess## ๐งฌ Structure
**app/** - App's Main Code (Controller, Entity, Model, View)\
**bin/** - Console for Doctrine\
**config/** - Main config of app\
**log/** - All types of Error logs\
**migrations/** - Doctrine DB Migrations\
**public/** - Publicly accessible (Dist assets, Routing, Media)\
**src/** - Developer Source Files (Assets, Utils)\
**temp/** - Storage for Temporary Files and Caches## ๐ง Technologies
- PHP
- Vite
- Blade
- Doctrine
- Nette DB
- JSON Web Tokens (JWT)
- (TS, SCSS, Tailwind, Prettier, ESLint, ...)## ๐ ๏ธ Installation Instructions
To start a project with this framework you can either clone this repository or download its source code from latest release
### Requirements
- ๐จโ๐ป Composer
- ๐ฆ Node Package Manager (pnpm - recommended)### Install dependencies
```bash
# php back-end part
composer install# vite front-end part
pnpm install
```### Assets
With usage of PageHelper you can add assets that will be rendered automatically on page load\
**NOTE**: Ensure that all your assets are defined in **vite.config**!If everything is set up correctly, assets are automatically mapped, resolved and added to the page.\
In development mode, live Vite server versions are loaded. (if that fails, it attempts to load the production assets from public/dist directory)```bash
# Add assets to the Page/View
PageHelper::setAssets(['ts/app.ts']);# Preview assets in real time (Vite + HMR)
pnpm run dev# Build assets (src/assets -> public/dist)
pnpm build
```### Setup .env
- Database Credentials
- JWT Secret and Algorithm
- Vite Server Destination
- Preferred mode (client / api)```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]`
## ๐ Model Guide
Model routes are automatically generated by "action..." methods commonly written in camel case\
(e.g. `actionGet()` accessed by `/[model]/get`)Models default action can be made by setting only\
`action` method -> `/[model]/`Models can be nested as much as you want by namespaces\
`Model\Users\Admin` -> `/Users/Admin/[action]`### Routes Summary
Default Method: `/[model]/`\
Model Methods: `/[model]/[action]`\
Nested Models: `/[namespace]/[model]/[action]`## ๐ 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
```## ๐งน Linting
This project utilizes Prettier and ESLint for code formatting and style consistency
```bash
# Check for linting errors and warnings
pnpm lint
pnpm prettier# Automatically fix linting errors and warnings
pnpm lint:fix
pnpm prettier:fix
```---
Made with โค๏ธ by
@germondai