承接 eye4web/zf2-site-config 相关项目开发

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

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

eye4web/zf2-site-config

Composer 安装命令:

composer require eye4web/zf2-site-config

包简介

Site-configuration module for Zend Framework 2

README 文档

README

Build Status Code Climate Test Coverage Latest Stable Version License Total Downloads

Introduction

This modules allows you to easily get site config in all of your files. The module can, out-of-the-box, read config values from the following:

  • DoctrineORM
  • Files(supported by \Zend\Config\Reader)
    • ini
    • json
    • xml
    • yaml
    • javaproperties
    • php array

Note: This module does not help you write the config, you have to take care of that yourself.

Installation

  1. Run the followng composer command:

    $ composer require eye4web/zf2-site-config:dev-master
  2. Enable it in your application.config.php file.

    <?php
    return array(
        'modules' => array(
            // ...
            'Eye4web\SiteConfig'
        ),
        // ...
    );
  3. Copy config/eye4web.siteconfig.global.php.dist to config/autoload/eye4web.siteconfig.global.php

  4. Edit the config to fit your needs

Usage

It is very easy to get config values, anywhere in your files.

View

To get a config value in a view-file(or layout): $this->siteConfig($configKey, $default) $default is optional

Controller

To get a config value in a controller: $this->siteConfig($configKey, $default) $default is optional

Any file from service-manager

This module comes with an initializer, so to get the SiteConfigService into a file, all you have to do is

  • Make your file implement Eye4web\SiteConfig\Service\SiteConfigAwareInterface
  • Use the trait Eye4web\SiteConfig\Service\SiteConfigAwareTrait
namespace YourModule\Service;

use Eye4web\SiteConfig\Service\SiteConfigAwareTrait;
use Eye4web\SiteConfig\Service\SiteConfigAwareInterface;

class YourAwesomeService implements SiteConfigAwareInterface
{
    use SiteConfigAwareTrait;
}
  • Now you can do $this->getSiteConfigService()->get($configKey, $default), $default is optional

Configuration

See config/eye4web.siteconfig.global.php.dist for configurable values

Readers

The modules supports many different readers, by deault it uses DoctrineORMReader

DoctrineORM

This reader reads config values from your database. This module is setup to use DoctrineORM by default, so all you have to do is

  1. Create schema
    • Use the doctrine script: php ./vendor/bin/doctrine-module orm:schema-tool:update --force or
    • Create the table yourself, see data/sql folder for schema
  2. Add your config values to the database. You only have to fill key and value, the rest of the fields are just convenience fields

Files

This module uses Zend\Config to read config from files. It can read config from the following file types:

  • ini
  • json
  • xml
  • yaml
  • javaproperties
  • php array

To read config from a file, all you have to do is:

  1. Create your file and add your config values
  2. Edit eye4web.siteconfig.global.php and set the path to your config file

You can read config from a single file, but you can also read from multiple files, just use an array of file names instead of a single string

Create-your-own

It is very easy to create your own reader, just follow these steps:

  1. Create your reader. It must implement Eye4web\SiteConfig\Reader\ReaderInterface
  2. Add your reader to the service-manager
  3. Edit eye4web.siteconfig.global.php and set the name of your reader
  4. Make a pull-request so others can benefit from your reader ;)

eye4web/zf2-site-config 适用场景与选型建议

eye4web/zf2-site-config 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 21.91k 次下载、GitHub Stars 达 7, 最近一次更新时间为 2015 年 06 月 14 日, 在 PHP 生态内属于活跃度较高的组件。

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

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

围绕 eye4web/zf2-site-config 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

  • Stars: 7
  • Watchers: 6
  • Forks: 6
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-06-14