symfony-micro

Use Symfony as a microframework.

Github星跟蹤圖

Build Status
Scrutinizer Code Quality
SensioLabs Insight
Packagist
Installs
license

Symfony micro-framework

Use Symfony as a microframework.

Installation

Create a new project with Composer.

composer create-project ikoene/symfony-micro

MicroKernelTrait

The MicroKernelTrait allows you to create a fully-functional Symfony application in as little as one file. It allows you to start with a tiny application, and then add features and structure as you need to. Its goal to give you the power to choose your bundles and structure. Since you're only enabling features and bundles you're actually going to use, your application gets a performance boost in comparison with using the Symfony full-stack framework.

Bundles

These bundles are registered in the MicroKernel:

While you could argue what exactly should and should not be included in a microframework, I found myself always using these bundles. So they're enabled by default. Don't want to use Twig as your template engine? Remove it in the MicroKernel.

When working in a dev or test environment, the MicroKernel also registers the necesarry bundles to be able to debug your project:

Usage

Development

Build your application in the AppBundle. You're free to structure your application as you want, but following the typical Symfony bundle structure has it's advantages. For one, it would be easier to migrate to a full-stack Symfony project if your application grows too big.

But, as I said, the choice is yours.

Register bundles

Missing some features? Register your bundles in the MicroKernel:

...
	$bundles = array(
		new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
		new Symfony\Bundle\TwigBundle\TwigBundle(),
		new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
		new AppBundle\AppBundle(),
	);
...

Console

While this is a microframework, chances are you'll still need the console. Use it like this:

./console

PHPUnit Testing

Run all tests with this command:

bin/phpunit -c .

Additional info

Building your own Framework with the MicroKernelTrait

主要指標

概覽
名稱與所有者ikoene/symfony-micro
主編程語言PHP
編程語言PHP (語言數: 2)
平台
許可證MIT License
所有者活动
創建於2015-12-07 21:20:17
推送於2017-12-21 19:16:40
最后一次提交2017-12-21 20:15:49
發布數6
最新版本名稱1.0.5 (發布於 )
第一版名稱1.0.0 (發布於 )
用户参与
星數35
關注者數2
派生數1
提交數38
已啟用問題?
問題數1
打開的問題數0
拉請求數1
打開的拉請求數0
關閉的拉請求數0
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?