wallaceosmar/carion-framework 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

wallaceosmar/carion-framework

最新稳定版本:v0.0.1

Composer 安装命令:

composer require wallaceosmar/carion-framework

包简介

A basic singleton registry manager.

README 文档

README

Carion is a simple singleton manager framework.

Installing

composer require wallaceosmar/carion-framework

How Use

The access of the values can be due to a object value or array access.

require_once './vendor/autoload.php';

$carion->example = 'example';

$carion['example2'] = 'example2';

echo $cation->example;
echo $carion['example2'];

Seting a singleton

Singleton is used to call some functions or instantiate custom class.

Setting a singleton to be used later

$carion = new Carion\Carion();

$carion->singleton( 'example', function () {
    return 'example';
});

echo $carion->example;

Setting a singleton with parameter

The function singleton map the names of the paramter to a singleton register in the class.

$carion = new Carion\Carion();

$carion->set('value', 'example');

$carion->singleton( 'example', function ( $value ) {
    return $value;
});

echo $carion->example;

If the does`t have a value to the paramter, will be seted null as the value.

$carion = new Carion\Carion();

$carion->singleton( 'example', function ( $value ) {
    if ( 'example' == $value ) {
        $value = md5( $value )';
    }
    return $value;
});

echo $carion->example;

Calling a function or class method

You can call a function or a class method using the function call.

The function call is reponsibly to map all the paramters.

echo $carion->call(function( $value1, $value2 ) {
    return $value1 + $value2;
}, array( 10, 20 ));

Parsing a array with key name overwrite the order of values.

echo $carion->call(function( $value1, $value2 ) {
    return $value1 + $value2;
}, array( 10, 20, 'value1' => 0 ));

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-12-03

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固