定制 regeda/castel 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

regeda/castel

Composer 安装命令:

composer require regeda/castel

包简介

Castel is a fast Dependency Injection Container for PHP 5.3

README 文档

README

Castel is a fast Dependency Injection Container. The class for PHP 5.3 consists of just one file.

Build Status

Installing

Pick up the src/Castel.php file or install it with Composer :

{
    "require": {
        "regeda/castel": "0.1.*"
    }
}

Creating a container is a matter of instating the Castel class

$container = new Castel();

Defining parameters

$container->share('foo', 'bar');
$container->share('something', new Something());

Retrieving parameters as plain properties:

$container->foo; // bar
$container->something; // instance of Something class

Defining services

Services are defined by anonymous functions that return an instance of an object

$container->share('session', function () {
    return new Session();
});

Using the defined services

$session = $container->session; // instance of Session class

Extending services after creation

$container->share('mail', function () {
    return new \Zend_Mail();
});
$container->extend('mail', function ($mail, $container) {
    $mail->setFrom($container->getValue('mail.default_from'));
    return $mail;
});

Source: https://github.com/regeda/castel

统计信息

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

GitHub 信息

  • Stars: 6
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-03-15

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固