vicgarcia/slimproject

SlimProject is a collection of classes and a skeleton project installer for use with the Slim framework and Commando CLI library

Installs: 205

Dependents: 0

Stars: 3

Watchers: 1

Language: PHP

0.8.0 2015-02-13 03:49 UTC

README

SlimProject is a combination of components that I've created to simplfiy getting started with development using PHP with the Slim framework, the Commando CLI library, Doctrine ORM and Redis caching.

My goal was a to build a good starting point to get up and running quickly with a new idea without having to spend too much time on the boilerplate parts.

Create a directory for your project and change into it

mkdir myproject
cd myproject

Create a composer file and include the slimproject dependency

{
    "minimum-stability": "dev",
    "require": {
        "vicgarcia/slimproject": "dev-master"
    }
}

Use composer to install the SlimProject dependencies

# if you don't have composer already ...
curl -s http://getcomposer.org/installer | php
php composer.phar install

# if you have composer installed globally ...
composer install

Run the slimproject.sh script to create the rest of the project

./vendor/vicgarcia/slimproject/extras/slimproject.sh

I've added a function to my .bashrc to automate this ...

# function added in .bashrc
function slimproject() {
    mkdir $1
    cd $1
    curl -o composer.json -L https://raw.githubusercontent.com/vicgarcia/slimproject/master/extras/composer.json
    composer install
    ./vendor/vicgarcia/slimproject/extras/slimproject.sh
}

# then you can use the function like this
slimproject new-project

# this will create a folder named 'new-project' with the project inside

SlimProject Components

SlimProject\Redis

  • Configuration container and static factory method for redis client

SlimProject\Doctrine

  • Configuration container and static factory method for creating an entity manager
  • SlimProject also includes scripts and config file examples for use with Doctrine

SlimProject\CacheInterface, SlimProject\Cache & SlimProject\NoCache

  • CacheInterface defines standard cache methods
  • Cache uses Redis to cache to fast key-value store
  • NoCache allows you to disable caching via DI of NoCache object

Scripts And Other Extras

In addition to the component classes, I've included a bunch of other code snippets in the /extras directory for working with Slim. These include sample application components, configurations, and scripts. Copy these to your project and modify them as your needs dictate.

3rd Party Code

These 3rd party libraries are included via SlimProjects composer file.

  • Slim, mvc microframework and additional views components
  • Twig, templating engine used with Slim
  • Commando, a library for structuring CLI apps
  • Doctrine, an ORM and DBAL supporting Postgres and MySQL
  • Requests, an http client based on popular python lib
  • PHPUnit, unit testing framework

This software is released entirely as is. Everything not included in this project (so all the dependencies) is property of it's respective authors. Use this as you see fit and don't hold myself or anybody else responsible for it.

Vic Garcia | vicg4rcia.com