Experimental subset of laravel components

1.0.15 2014-10-31 23:12 UTC


Deficient give you some of laravel components, without the entire environment.
You can also add some other package because I keepd the IOC and service-provider booting.
It has also some helper to keep a concise syntax.

Basically you'll get:

  • eloquent
  • validation
  • translation
  • blade
  • burp (a tiny, non blocking, router)


In some cases, with big projects, you can't switch to Laravel from start, you need to move step by step, section by section. In some other, you need just a great ORM, or/and template engine, or form validation, translations.. but not a "framework".

Think to "deficient" as a way to use laravel without move to laravel, or (better) a way to embrace laravel slowly and quietly using each component when, where and how you like in your current app.

On the other hand:

  • deficient make a vendor of 3.5 mb
  • laravel build a vendor of 20 mb

(using illuminate components of 4.1 --prefer-dist version for both)


install via composer creating or adding dependency to your composer.json:

    "require": {
        "zofe/deficient": "dev-master"

then running composer install


you can setup a basic file structure, to store configurations, views, language files, and models.
The suggestd one is:


To create this structure you can simply run a setup command:
(important: be sure that you've no folders conflict with your current application)

php vendor/zofe/deficient/deficient setup:folders

You must set write permission to /cache folder.
Then you can make an index.php in your root or use Deficient where you want in your project:


require_once __DIR__ . '/vendor/autoload.php';

use Zofe\Deficient\Deficient;

//booting from current directory (needed to find config and other folders)

//db stuff
$results = select('select * from mytable');

$validator = validator(array('title'=>'abc','description'=>'description bla b...'), 
if ($validator->fails()){
    dd( $validator->messages() );

//translation (return 'thankyou' value @ current locale: /lang/en/messages.php )
echo trans('messages.thankyou');

$users = User::all();

echo blade('hello', compact('results','users'));

Laravel Facades

You can also use laravel Facades, declaring or using full namespaces, i.e.:


use Zofe\Deficient\Deficient;
use Illuminate\Support\Facades\Validator;
use Illuminate\Support\Facades\DB;

$validator = Validator::make(....
$results = DB::select(....

Need a Router?

Deficient comes without laravel router, but it has simple alternative: burp router.
So you can do something like this:



route_get('^/user/(\d+)$', function( $id ) {
    $user = User::find($id);
    echo blade('user_detail', compact('user'));

route_post('^/user/(\d+)$', function( $id ) {
    $user = User::find($id)->update($_POST);
    echo blade('user_detail', compact('user'));

route_missing(function() {
    echo blade('error', array(), 404);


To create a basic index.php, .htaccess, and some route you can use this command
(important: be sure that you've no index.php and .htaccess in your current application)

php vendor/zofe/deficient/deficient setup:router