smith981/silex-skeleton 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

smith981/silex-skeleton

Composer 安装命令:

composer require 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.

README 文档

README

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.

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

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

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

For examples, see comments in index.php.

Doctrine DBAL

Uncomment the following code in /index.php and set your database parameters:

<?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'

cd bin
./doctrine

Super-Quick Console Configuration

Just plug your connection parameters into /bin/boostrap_doctrine.php. Everything else is done!

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

Entities

By default, this package supports mapping info via annotations. See Doctrine 2 documentation.

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.

To remove the sample entities, delete those files and recreate the schema:

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:

./doctrine orm:schema-tool:update

统计信息

  • 总下载量: 80
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 7
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 7
  • Watchers: 2
  • Forks: 0
  • 开发语言: JavaScript

其他信息

  • 授权协议: Unknown
  • 更新时间: 2013-01-03