2017 © Pedro Peláez
 

library silex-skeleton

This is a working skeleton used to rapidly develop a new Silex site, with Twitter Bootstrap, Twig, and a Doctrine ORM provider installed and registered. See https://github.com/smith981/silex-skeleton for installation instructions.

image

smith981/silex-skeleton

This is a working skeleton used to rapidly develop a new Silex site, with Twitter Bootstrap, Twig, and a Doctrine ORM provider installed and registered. See https://github.com/smith981/silex-skeleton for installation instructions.

  • Monday, February 25, 2013
  • by smith981
  • Repository
  • 0 Watchers
  • 0 Stars
  • 80 Installations
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

silex-skeleton

This repository has not been maintained in quite a while. Please do not use it!

This is a working skeleton used to rapidly develop a new Silex site, with Twitter Bootstrap, Twig, and a Doctrine ORM provider installed and registered. It also includes the Doctrine console and a CRUD generator in the /bin directory, which uses components from Zend Framework 2.x., (*1)

Included Packages

  • Twig 1.12 (twig/twig)
  • Doctrine ORM Provider (taluu/doctrine-orm-provider)
  • Twitter Bootstrap installed is in 'web' directory. The requisite CSS and JS includes are in the views/base.twig.html template. Extend the base template in other Twig files if you want to use Bootstrap.
  • Zend/Form

Installation using Composer

  1. From the web root:
composer create-project --stability="dev" smith981/silex-skeleton silex
  1. Or, if you haven't renamed composer.phar:
php composer.phar create-project --stability="dev" smith981/silex-skeleton silex

This will create the installation in the 'silex' directory. 2. Change the title in src/smith981/silex-skeleton/views/base.twig.html so that it shows your site name. 3. If you need a database, open index.php and uncomment the lines that register Doctrine DBAL and edit the connection parameters there. 4. Create your routes as needed in index.php, and your views in the src/smith981/silex-skeleton/views., (*2)

Package includes .htaccess used for removing 'index.php' from url! Be sure .htaccess overrides are allowed by your httpd.conf settings., (*3)

I have not attempted to run this under IIS, pull requests are welcome on this., (*4)

For examples, see comments in index.php., (*5)

Doctrine DBAL

Uncomment the following code in /index.php and set your database parameters:, (*6)

<?php

// /index.php

// ...

/**
 * Register Doctrine DBAL if needed
 */
$app->register(new Silex\Provider\DoctrineServiceProvider(), array(

    // Doctrine DBAL settings goes here
    'db.options' => array(
          'driver'   => 'pdo_mysql',
        'user'     => 'username',
        'password' => 'pass',
        'dbname'   => 'dbname',
        'host'     => 'localhost'
    )
));

Doctrine Console

The doctrine console is located in '/bin', (*7)

cd bin
./doctrine

Super-Quick Console Configuration

Just plug your connection parameters into /bin/boostrap_doctrine.php. Everything else is done!, (*8)

<?php

// /bin/bootstrap_doctrine.php

// ...

/**
 * database configuration parameters for Doctrine console
 */
$conn = array(
    'driver'   => 'pdo_mysql',
    'dbname'   => 'test',
    'user'     => 'testuser',
    'password' => 'secret',
    'host'     => 'localhost',
);

Using the Doctrine ORM

While you are welcome to simply use the Doctrine DBAL, the Doctrine ORM is available as well., (*9)

Entities

By default, this package supports mapping info via annotations. See Doctrine 2 documentation., (*10)

Your entity models go in /entities. Any .php file in that directory will be included automatically. The three sample entities from the Doctrine 2 documentation are included., (*11)

To remove the sample entities, delete those files and recreate the schema:, (*12)

cd bin
./doctrine orm:schema-tool:drop --force
./doctrine orm:schema-tool:create

Add your own entity files in /src/smith981/silex-skeleton/entities and create or update the schema:, (*13)

./doctrine orm:schema-tool:update

The Versions

25/02 2013

dev-master

9999999-dev

This is a working skeleton used to rapidly develop a new Silex site, with Twitter Bootstrap, Twig, and a Doctrine ORM provider installed and registered. See https://github.com/smith981/silex-skeleton for installation instructions.

  Sources   Download

The Requires