dijky/spot-service-provider
Composer 安装命令:
composer require dijky/spot-service-provider
包简介
A Pimple 3 ServiceProvider for the Spot2 ORM
README 文档
README
SpotServiceProvider allows you to easily integrate the Spot ORM with Pimple 3.
Installation
Simply require the composer package in your application:
composer require dijky/spot-service-provider
or in your composer.json:
{
...
"require": {
"dijky/spot-service-provider": "~2.0"
}
}
If you don't use Composer, clone the Git repository or download the zipball.
You will have to do autoloading yourself then.
Usage
Register the SpotServiceProvider in your application bootstrap file:
$app->register(new Dijky\Pimple\Provider\SpotServiceProvider(), array(
'spot.connections' => array(
'website' => '<dsn>',
'forum' => '<dsn>'
)
));
You can add as many connections as you like.
The service provider also takes connections already configured for DoctrineServiceProvider:
$app['spot.connections'] = function() use ($app) {
return $app['dbs'];
};
Notice the closure? This way, the dbs service will only be accessed (and initialized) as needed.
You can still override or extend it later on in your bootstrap code.
The first connection in $app['spot.connections'] will be set as default.
The default connection can also be set to connection abc with
$app['spot.connections.default'] = 'abc';
Services
SpotServiceProvider exposes the following services:
- spot: The
Spot\Locatorinstance to use the Spot ORM. - spot.config: The
Spot\Configinstance to configure the spot service.
It takes the following configuration values:
- spot.connections: Set this to a key-value array (or Pimple container) with connection names as keys and connection strings (DSNs) or instances of
Doctrine\DBAL\Connectionas values. - spot.connections.default (optional): Set this to the connection name that should be set as default. Unset with
null.
Notice: once the spot service is first accessed, changing spot.config, spot.connections, or spot.connections.default will have no effect on it.
License
This software is provided under the BSD 3-clause license.
Refer to LICENSE for the full license text.
Changelog
New in 2.0
- Add support for Pimple 3 (incl. Silex 2)
- [BC BREAK] Drop support for Silex 1.x / Pimple 1.x
- [BC BREAK] Change namespace to
Dijky\Pimple\...fromDijky\Silex\...
dijky/spot-service-provider 适用场景与选型建议
dijky/spot-service-provider 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 526 次下载、GitHub Stars 达 2, 最近一次更新时间为 2014 年 11 月 29 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「orm」 「pimple」 「spot2」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 dijky/spot-service-provider 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 dijky/spot-service-provider 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 dijky/spot-service-provider 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Simple service container for PHPUnit tests
g4 dependencies injection container based on Pimple
A Hero for your Laminas and Mezzio application to trap php errors & exceptions
Kinikit - PHP Application development framework MVC component
PHP Database ORM for Symfony1. Do NOT use for new projects: please move to a newest Symfony release and Doctrine2
Simple service manager based on Pimple
统计信息
- 总下载量: 526
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 17
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2014-11-29