承接 pomm/pomm-service-provider 相关项目开发

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

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

pomm/pomm-service-provider

Composer 安装命令:

composer require pomm/pomm-service-provider

包简介

Pomm service provider for the Silex µframwork.

README 文档

README

This is the Pomm service provider for the Silex microframework.

Installation

There are numerous ways to install PommServiceProvider. The sortest one being to use this script. It will create directory tree structure and your composer.json file (See Composer section below).

Composer

Composer is the easiest way to get the Service provider installed and running. Just add your composer.json the following:

"pomm/pomm-service-provider":    "dev-master"

in the require section. Invoke « composer.phar install » and it should be installed with the Pomm library.

Git submodules

If you use git, use the submodules:

$ mkdir vendor
$ git submodule add git://github.com/chanmix51/PommServiceProvider.git vendor/ghub/PommServiceProvider
$ git submodule add git://github.com/chanmix51/Pomm.git vendor/pomm

Otherwise, you can just download the archive, expand it in a subdirectory and tell the autoloader that GHub\Silex\Pomm namespace is under the src project subdirectory.

Using Pomm Service

It is advised to split your application in 3 files:

bootstrap.php
Where extensions are loaded and configured
application.php
Where you define your controllers.
generate_model.php
The CLI tool to scan the postgresql's schemas and generate the model files.

This way, the index.php file is reduced to its simplest expression:

<?php #index.php

require(__DIR__.'/../application.php');

$app->run();

The application.php itself is just composed by your controllers. It includes the configuration by requiring the bootstrap.php file:

<?php #bootstrap.php

require_once __DIR__.'/vendor/autoload.php';

$app = new Silex\Application();

// EXTENSIONS
...
# pomm
$app->register(
    new Pomm\Silex\PommServiceProvider(),
    array(
        'pomm.class_path' => __DIR__.'/vendor/pomm',
        'pomm.databases' => array(
            'default' => array(
                'dsn' => 'pgsql://user:pass@host:port/dbname',
            )))
        );

The PommServiceProvider class takes the following arguments:

  • pomm.class_name: This is the service class to be used (optional) default is Pomm\Service. The given service class has to extend Pomm\Service.
  • pomm.databases: an array of databases in the format 'name' => array('dsn' => $dsn, 'class' => 'My\\Database\\Class').

The extension will instanciate the Database class for each of your connection which does not mean it will open connections. Connections are opened if you perform a statement in a connection. If you want to use your own Database class, provide its full path in the class parameter. By default, this parameter is set to Pomm\Connection\Database.

In the example above, we register a Model namespace to the autoloader so generated files would be places in Model\DbName\SchemaName namespace.

Generating Map files

Create the following script:

<?php #generate_model.php

require __DIR__.'/bootstrap.php';

$scan = new Pomm\Tools\ScanSchemaTool(array(
    'schema' => 'YOUR SCHEMA',
    'database' => $app['pomm']->getDatabase(),
    'prefix_dir' => __DIR__.'/Model',
    ));
$scan->execute();

pomm/pomm-service-provider 适用场景与选型建议

pomm/pomm-service-provider 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.91k 次下载、GitHub Stars 达 4, 最近一次更新时间为 2012 年 08 月 27 日, 在 PHP 生态内属于活跃度较高的组件。

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

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

围绕 pomm/pomm-service-provider 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

  • Stars: 4
  • Watchers: 2
  • Forks: 4
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2012-08-27