2017 © Pedro Peláez
 

library slim-dic-example

A Slim Framework skeleton application utilising Symfony DIC to create a super thin MVC

image

the-matrix/slim-dic-example

A Slim Framework skeleton application utilising Symfony DIC to create a super thin MVC

  • Tuesday, April 3, 2018
  • by chippyash
  • Repository
  • 2 Watchers
  • 5 Stars
  • 39 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 9 Versions
  • 0 % Grown

The README.md

the-matrix/slim-dic-example

PHP 5.6 PHP 7.1, (*1)

Use this skeleton application to quickly setup and start working on a new Slim Framework 3 application incorporating the power of the Symfony 2 Dependency Injection component or Symfony 4 Dependency Injection component., (*2)

Symfony 2 is supported by PHP 5.6.. Symfony 4 is supported by PHP 7.1., (*3)

This demo also uses Sensio Labs' Twig template library, but you don't have to - use Smarty instead, or native PHP for your view scripts - it's up to you, - just configure the DIC definition files per your requirements. (Don't forget to add/remove dependencies in composer.json if you do.), (*4)

Also included is a minimal Controller (MVC) implementation, that allows you to seperate out the routing from the site application logic. Again, you don't need to use it if you don't want to., (*5)

This skeleton application was built for Composer. This makes setting up a new Slim Framework application quick and easy. You are not intended to include this as a composer requirement, but to create a new Composer app with it and move on., (*6)

This is a PHP5.6+ application, (*7)

Install Composer

Install [Composer] (https://getcomposer.org/). It is useful to symlink the composer.phar file into /usr/local/bin or your ~/bin directory, dependent on your circumstances e.g., (*8)

    cd ~/bin
    ln -s /path/to/composer.phar composer
    chmod u+x composer

Install the Application

After you install Composer, run this command from the directory below the one in which you want to install your new Slimdic application., (*9)

composer create-project the-matrix/slim-dic-example my-app-name 3.* , (*10)

Replace my-app-name with the desired directory name for your new application. When the installer asks Do you want to remove the existing VCS (.git, .svn..) history? [Y,n]? , (*11)

then enter 'Y'., (*12)

(NB. If you want the Slim 2 + Symfony 2 version of this library, use 1.* as the version number above.), (*13)

The rest of this section comes under the general heading of 'Teaching Grandma to Suck Eggs', but hey - someone out there is a newby!, (*14)

You'll want to:, (*15)

  • Point your virtual host document root to your new application's public/ directory., (*16)

  • Ensure your web server has rights to your root directory. It needs to be able to read and write to the appropriate directories e.g., (*17)

    sudo chgrp -R apache my-app-name
    sudo chmod -R g+r my-app-name
    sudo chmod -R g+w my-app-name/spool

ensures that both you and the server can read and write. NB, check the user name that your server is running under, something like:, (*18)

    ps aux | grep httpd
    # or
    ps aux | grep apache

normally does the trick., (*19)

Have a care for security. Dependent on your server, set the vhost to allow public access to the ./public directory only. The app needs to be able to see everything from one directory below, and no more., (*20)

Dependent on how you have set up your vhost, you may need to add an entry to the /etc/hosts file. I like to set each app I'm developing on it's own dns name so typically, I'll add something like, (*21)

127.0.0.1 my-app.localhost , (*22)

to /etc/hosts. Obviously, the name needs to match your web server vhost name, (*23)

Now assuming you've got all that, point your browser at the the vhost name and off you go - you should be seeing a nice page. Now browse to /logon and check out the cool demo logon. It doesn't matter if you get it wrong - the answer will be revealed., (*24)

So you did the demo. Now look at the code - it's all in there under the Site directory and in the public/index.php file., (*25)

And remember, once you've installed this demo template, you can change it without worrying that a composer update is going to override any code that you write. That will just update any packages you have defined in your composer.json file., (*26)

More reading

The Site Directory, (*27)

Using the Controller, (*28)

Find more

Check out ZF4 Packages for more packages, (*29)

History

V1.0.0 Slim 2 + Symfony 2, (*30)

V2.0.0 Slim 3 + Symfony 2, (*31)

V2.0.1 Add link to packages, (*32)

V2.0.2 bug fix from Nigel Greenway, (*33)

V2.0.3 code clean. readme typos. bug fix from Nigel Greenway, (*34)

V2.1.0 Update for PHP 7.1, (*35)

V2.1.1 update composer - forced by packagist composer.json format change, (*36)

V3.0.0 BC Break. Remove support for PHP <5.6, (*37)

The Versions

03/04 2018

dev-master

9999999-dev http://zf4.biz/packages?utm_source=packagist&utm_medium=web&utm_campaign=blinks&utm_content=slimdicexample

A Slim Framework skeleton application utilising Symfony DIC to create a super thin MVC

  Sources   Download

GPL 3.0 GPL-3.0-or-later

The Requires

 

dependency injection mvc symfony slim microframework

03/04 2018

3.0.0

3.0.0.0 http://zf4.biz/packages?utm_source=packagist&utm_medium=web&utm_campaign=blinks&utm_content=slimdicexample

A Slim Framework skeleton application utilising Symfony DIC to create a super thin MVC

  Sources   Download

GPL-3.0-or-later

The Requires

 

dependency injection mvc symfony slim microframework

08/02 2018

2.1.1

2.1.1.0 http://zf4.biz/packages?utm_source=packagist&utm_medium=web&utm_campaign=blinks&utm_content=slimdicexample

A Slim Framework skeleton application utilising Symfony DIC to create a super thin MVC

  Sources   Download

GPL-3.0-or-later

The Requires

 

dependency injection mvc symfony slim microframework

04/02 2018

2.1.0

2.1.0.0 http://zf4.biz/packages?utm_source=packagist&utm_medium=web&utm_campaign=blinks&utm_content=slimdicexample

A Slim Framework skeleton application utilising Symfony DIC to create a super thin MVC

  Sources   Download

GPL 3.0

The Requires

 

dependency injection mvc symfony slim microframework

17/06 2016

2.0.3

2.0.3.0 http://zf4.biz/packages?utm_source=packagist&utm_medium=web&utm_campaign=blinks&utm_content=slimdicexample

A Slim Framework skeleton application utilising Symfony DIC to create a super thin MVC

  Sources   Download

GPL 3.0

The Requires

 

dependency injection mvc symfony slim microframework

15/06 2016

2.0.2

2.0.2.0 http://zf4.biz/packages?utm_source=packagist&utm_medium=web&utm_campaign=blinks&utm_content=slimdicexample

A Slim Framework skeleton application utilising Symfony DIC to create a super thin MVC

  Sources   Download

GPL 3.0

The Requires

 

dependency injection mvc symfony slim microframework

22/03 2016

2.0.1

2.0.1.0 http://zf4.biz/packages?utm_source=packagist&utm_medium=web&utm_campaign=blinks&utm_content=slimdicexample

A Slim Framework skeleton application utilising Symfony DIC to create a super thin MVC

  Sources   Download

GPL 3.0

The Requires

 

dependency injection mvc symfony slim microframework

01/02 2016

2.0.0

2.0.0.0 http://the-matrix.github.io

A Slim Framework skeleton application utilising Symfony DIC to create a super thin MVC

  Sources   Download

GPL 3.0

The Requires

 

dependency injection mvc symfony slim microframework

02/03 2015

1.0.0

1.0.0.0 http://the-matrix.github.io

A Slim Framework skeleton application utilising Symfony DIC to create a super thin MVC

  Sources   Download

GPL 3.0

The Requires

 

dependency injection mvc symfony slim microframework