Skip to content

Introduction

Requirements

  • PHP 7.0 or latest
  • PDO
  • Zlib Functions enabled

Installation

  1. 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.

  2. Adjust the value of RewriteBase line in the .htaccess file located in your app root and point to your Snappy working directory.

 RewriteBase /yourworkingdirectory
  1. Adjust environment configuration file located in /config directory to your needs.

  2. 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.sql file 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
DirectoryDescription
assetsTo store your asset files
configFor configurations or middlewares list
coreContains main files that make this framework works
core/errorGlobal error handler
core/traitsGlobal traits
logTo store log file. Further details of this is explained in Log page
srcYour main working directory
src/controllerFor your controllers as the handler of the router endoint
src/modelFor your model files that contain SQL queries
src/middlewareFor your middlewares
src/helperFor your own custom library
src/viewFor your template files
vendorFor 3rd party libraries