arzynik/cana
Composer 安装命令:
composer require arzynik/cana
包简介
PHP OO Framework
关键字:
README 文档
README
cana is an mvc php framework for rapid object oriented development. it combines existing php framework fundamentals found in frameworks such as zend, and combines it with easy to use, extended object support found in ruby, python, and jquery. cana's name speaks for itself.
some cool shit you can do
grab an object from the database and cache it in mem
$shot = new BigBrother_Shot('DEV_DSM_000');
or do the same thing but with auto object creation, auto class aliasing, and removing the unnecessary quotes
$shot = Shot::o(DEV_DSM_000);
call a function on multiple database objects
Shot::o(DEV_DSM_000,DEV_DSM_100)->delete();
set a property on multiple objects and save them back to the db
echo Staff::o(DSM,MPR,SSW)->s('permission','MANAGER')->save();
set multiple properties on an object an save it
Shot::o(DEV_DSM_000)->s([
'date_due' => '2012-01-01',
'id_deliv_group' => 'LUMA'
])->save();
output a database object as json
echo Shot::o(DEV_DSM_000)->json();
or output multiple database objects as a single json object
echo Shot::o(DEV_DSM_000,534)->json();
modify several objects properties from a db query
c::db()->get('select * from shots where id_project="marvel"')->producer = 'DSM';
iterate using the db object
foreach (c::db()->get('select * from shots where id_project="marvel"') as $shot) {
print_r($shot);
}
set the producer property of two objects, then access those dbos from their cache and output their producer property
Shot::o(DEV_DSM_000,534)->producer = 'DSM';
echo Shot::o(DEV_DSM_000)->producer;
echo Shot::o(534)->producer;
this filter would be the same as this sql ((id_project=dev AND shot_name=DSV_DSM_000) OR (id_shot=534))
echo Shot::o(
['shot_name' => 'peanuts', 'id_project' => 'dev'],
'{"shot_name": "BACON"}',
DEV_DSM_000,
'534'
)->filter(
['id_project' => 'dev', 'shot_name' => 'DEV_DSM_000'],
['id_shot' => '534']
);
filter a set of objects to set the producer property on only specific items, then return the full set
$shots = Shot::o(['shot_name' => 'peanuts'],'{"shot_name": "BACON"}',DEV_DSM_000,534)
->filter('id_project','devs')
->set('producer','DSM')
->parent();
access the last items in the set
echo Shot::o('{"shot_name": "BACON"}',DEV_DSM_000,'534')->eq(-1);
constructing a set with several arguments, arrays, or sets, will merge the items insite
i::o(Shot::o(534),Shot_Element::o(4944))->each(function($key, $item) {
echo $this;
});
create a set from an already existing array sand iterate through them using foreach
foreach (i::o(Project::o('marvel')->shots(), Project::o('uw4')->shots()) as $shot) {
echo $shot;
}
use the query method to build a set, then loop through each item
Shot_Element::q('
select elements.* from tasks
left join elements on elements.id_shot_element=tasks.id_shot_element
left join shots on shots.id_shot=elements.id_shot
left join projects on projects.id_project=shots.id_project
where id_element="PLATE"
and id_task_status="NONE"
and id_elem_status!="FINL"
and elements.id_deliv_group!="CUT"
and (elements.id_staff="TDA" or elements.id_staff="JPR")
and shots.active=1
and projects.active=1
')->e(function($item) {
// do some cool stuff here
});
create the test function on the base cana object. this puts the function easily accesable in the global scope
c::extend(['test' => function() {
return 'this is a test';
}]);
echo c::test();
extend a class with a function that can access the object
Staff::extend(['simpleFunc' => function($me, $in) {
echo get_class($me).' '.$in;
}]);
Staff::o(DSM)->simpleFunc('got this');
extend a class to return a set result
Staff::extend(['devices' => function($me) {
return $me->q('select * from device where id_staff="'.$me->id_staff.'"');
}]);
Staff::o(DSM)->devices()->each(function($key, $item) {
print_r($item);
});
other stuff
cana is named after my new favorite bar here in LA -- Caña Rum Bar
arzynik/cana 适用场景与选型建议
arzynik/cana 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 8.63k 次下载、GitHub Stars 达 4, 最近一次更新时间为 2015 年 11 月 19 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「framework」 「php」 「mvc」 「oo」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 arzynik/cana 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 arzynik/cana 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 arzynik/cana 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
PHP Framework HLEB2 is the foundation of the web application. Provides ease of development and application performance.
Kinikit - PHP Application development framework MVC component
Alfabank REST API integration
Small extensible framework in PHP
Oauth 2 client for Ubiquity framework
Light, secure and intuitive PHP Framework.
统计信息
- 总下载量: 8.63k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 6
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-11-19