junker / model-service-provider
Model Service Provider for Silex
0.2.0
2020-06-18 15:27 UTC
Requires
- silex/silex: ~2.0
This package is auto-updated.
Last update: 2024-11-19 01:22:47 UTC
README
Model Service Provider for Silex
Requirements
silex 2.x
Installation
The best way to install ModelServiceProvider is to use a Composer:
composer require junker/model-service-provider
Examples
use Junker\Silex\Provider\ModelServiceProvider; #args: ($path, $namespace = NULL) $app->register(new ModelServiceProvider(__DIR__ . '/lib/Model')); # or $app->register(new ModelServiceProvider(__DIR__ . '/lib/Acme/Model', 'Acme\Model')); echo $app['UserModel']->getHello();
Model example:
#/lib/Acme/Model/UserModel.php namespace Acme\Model; use Junker\Silex\Model; class UserModel extends Model { public function getHello() { $app = $this->app; $db = $app['db']; return 'hello'; } }