2017 © Pedro Peláez
 

library sglim

A simple PHP MVC skeleton build on top of Slim

image

sglim/sglim

A simple PHP MVC skeleton build on top of Slim

  • Tuesday, April 12, 2016
  • by SiroDiaz
  • Repository
  • 1 Watchers
  • 2 Stars
  • 6 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Sglim

A Slim 3 MVC skeleton. It uses PDO for the model layer and Twig for the view layer. Also it depends of hassankhan/config library for load config files and the symfony/console package for the Sglim command line tool. Sglim can be extended adding few neccesary packages because Sglim goal is keep simple the Slim configuration., (*1)

Why Sglim?

There are many Slim framework skeletons but i don't see neither that like me. So i have decided to build my own "MVC" skeleton for small/medium APIs and dynamic websites when you need speed and low complexity in your apps., (*2)

Install

All you need to install Sglim is Composer. Run the following command., (*3)

``` bash $ composer create-project "sglim/sglim":"dev-master" app-name, (*4)


## Run the application Go into the public folder inside the project folder and then ``` bash $ cd app-name/public # run the server $ php -S 0.0.0.0:8000

Folders structure

Sglim uses different folders to organize your project based in other frameworks structure., (*5)

  • App, where is hosted main application folders as Models, Views, Routes, Api and Middlewares.
  • config, where you can find two configuration files: config_development and config_production. Both cantains database and Slim configuration and you can also set your Facebook, Twitter and other app secret keys.
  • public. The folder where are all application frontend files.
  • storage. Storage contains all rendered all Twig views(cache) and log files.

Command line

Sglim allows you many shortcuts to make things fast. Right now there are 3 main commands:, (*6)

Generate a new route file if the route doesn't exist., (*7)

``` bash $ php sglim make:route route-name, (*8)


**Generate a new model** ``` bash $ php sglim make:model model-name

Generate a new view HTML5 file, (*9)

bash $ php sglim make:view view-name, (*10)

FAQ / Contact

Question 1: Can i use an ORM instead of PDO extension? Yes, you can. I tried using Eloquent(Lavel ORM) and i had to do minor changes in the index.php file. Only i had to add a charset option in the configuration file but it works properly. It is pretty simple and if you love ORMs you can mix Sglim with the ORM that you want., (*11)

Question 2: Why doesn't Sglim include all Slim package like Slim-Csrf? Because the Sglim idea is to keep it simple. But maybe in future commits i will set them to Sglim package, (*12)

You can contact with me through Twitter(@Siro_Diaz) or email me <siro_diaz@yahoo.com>, (*13)

The Versions

12/04 2016

dev-master

9999999-dev

A simple PHP MVC skeleton build on top of Slim

  Sources   Download

MIT

The Requires

 

by Siro Diaz