Introduction
Requirements
- PHP 7.0 or latest
- PDO
- Zlib Functions enabled
Installation
Fork Snappy github repo to your own repo and clone it to your local machine or download as zip file and extract to your PHP web server.
Adjust the value of
RewriteBaseline in the .htaccess file located in your app root and point to your Snappy working directory.
RewriteBase /yourworkingdirectoryAdjust
environmentconfiguration file located in/configdirectory to your needs.Do
composer install
This repository includes example files for a controller, middleware, model, and a SQL schema to help you get started quickly. To try it out:
- Create a new database in MySQL.
- Import the
snappy.sqlfile included in this repo.
You're now ready to explore and build with Snappy!
Structure
Snappy applies MVC design pattern with OOP. There is no separated router to handle the endpoint url since the endpoint name and its handler are the controller name.
App
├─ assets
├─ config
├─ core
│ ├─ error
│ └─ traits
├─ log
├─ src
│ ├─ controller
│ ├─ model
│ ├─ middleware
│ ├─ helper
│ └─ view
├─ vendor
├─ .gitignore
├─ .htaccess
├─ composer.json
└─ index.php| Directory | Description |
|---|---|
assets | To store your asset files |
config | For configurations or middlewares list |
core | Contains main files that make this framework works |
core/error | Global error handler |
core/traits | Global traits |
log | To store log file. Further details of this is explained in Log page |
src | Your main working directory |
src/controller | For your controllers as the handler of the router endoint |
src/model | For your model files that contain SQL queries |
src/middleware | For your middlewares |
src/helper | For your own custom library |
src/view | For your template files |
vendor | For 3rd party libraries |