承接 unisharp/laravel-datacarrier 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

unisharp/laravel-datacarrier

Composer 安装命令:

composer require unisharp/laravel-datacarrier

包简介

Handle data and let it live in global scope

README 文档

README

Build Status Version License Total Downloads

Introduction

Provide an object as Facade to put all global variables togetther, clean your code. Normally we use it to passing variables from Controller to View.

And you can extend your formating method to help you format global data

Install Data Carrier

composer.json:

"require" : {
    "unisharp/laravel-datacarrier" : "~1.0"
}, 
"repositories": {
    "type": "git",
    "url": "https://github.com/UniSharp/laravel-datacarrier.git
}

save it and then

composer update    

Set ServiceProvider and Set Facade

in config/app.php:

  • ServiceProfider

      Unisharp\DataCarrier\DataCarrierServiceProvider::class,
    
  • alias

      'DataCarrier' => Unisharp\DataCarrier\DataCarrierFacade::class,
    

Usage

  • get and set global data

    you can use Facade to set and get items

      \DataCarrier::set('key', 1); // ['a' => 1]
    
      \DataCarrier::get('key'); // 1
    
      // you can set a default value for get method
    
      \DataCarrier::get('key', 0); // if you cannot get it, it will return 0
    
      $var = d('key', 0); // Quick access by d() helper.
      
      \DataCarrier::all(); // it will get an array with all items
    

    you can also use dot to seperate array

      # [ 
      #    'a' => [
      #        'b' => 'value'
      #    ]
      # ]
      
      \DataCarrier::get('a.b'); // 'value'
    
  • customize your format method (Add method into Data Carrier)

      \DataCarrier::extend('format', function ($data) {
          return number_format($data);
      })
    
  • format your data

      # ['num' => '100000']
      \DataCarrier::format('num') // 100,000
    

Helper can use helper to set, get your data

  • get, set function

      carrier_set('num', 1); // ['a' => 1]
      carrier_get('num'); // 1
    
  • use carrier() to muniplate container

      carrier() // it's just return App::make('DataCarrier')
    

Another way to work with DataCarier

  • get, set can replace by it

       carrier('num')->get();
       carrier('num')->set(5);
    
  • extend your formating method

      carrier()->extend('format', function ($data) {
          return number_format($data);
      })
    
  • use your formatting method

      carrier('num')->format(); // it will return formating result
    

unisharp/laravel-datacarrier 适用场景与选型建议

unisharp/laravel-datacarrier 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 757 次下载、GitHub Stars 达 1, 最近一次更新时间为 2015 年 10 月 05 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「data」 「api」 「view」 「laravel」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 unisharp/laravel-datacarrier 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 unisharp/laravel-datacarrier 我们能提供哪些服务?
定制开发 / 二次开发

基于 unisharp/laravel-datacarrier 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-10-05