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.
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
To start a project with this framework you can either clone this repository or download its source code from latest release
# php back-end part
composer install
# vite front-end part
pnpm install
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)
# 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
# to dupe example.env as .env
cp example.env .env
Entity CRUD operations depends on Request Methods Entity Schema returns tables / table with columns
Operations: /[entity]/[id]
Schema: /schema/[entity]
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]
Default Method: /[model]/
Model Methods: /[model]/[action]
Nested Models: /[namespace]/[model]/[action]
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/"
# To run doctrine console
php bin/console ...
# if you need commands list
php bin/console list
This project utilizes Prettier and ESLint for code formatting and style consistency
# Check for linting errors and warnings
pnpm lint
pnpm prettier
# Automatically fix linting errors and warnings
pnpm lint:fix
pnpm prettier:fix