adback/adback-sdk-php-symfony 问题修复 & 功能扩展

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

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

adback/adback-sdk-php-symfony

Composer 安装命令:

composer require adback/adback-sdk-php-symfony

包简介

A bundle to use the AdBack ApiClient

README 文档

README

Scrutinizer Code Quality Code Coverage Latest Stable Version Total Downloads License

This bundle will use the library to call the AdBack api.

See the AdBack website for more informations.

Installation

Launch the composer command :

    composer require adback/adback-sdk-php-symfony

If you are using a version of symfony >= 4, it should automatically activate the bundle.

If you are using a version of symfony < 4, you have to add the bundle to your AppKernel.php file :

    new Adback\ApiClientBundle\Adback\ApiClientBundle(),

Configuration

Symfony 4

In your .env file, the following lines should have been added :

    ADBACK_API_CLIENT_ACCESS_TOKEN=adback-access-token

Modify it with the token provided by the AdBack team.

Then follow the paragraph linked to the type of cache you have choosen :

Redis

In the config/packages/adback_sdk_php.yaml you should add the following configuration :

    cache_type: redis
    cache_service: redis_service

redis_service is the name of the redis connection you are using to store the data.

Doctrine

In the config/packages/adback_sdk_php.yaml you should add the following configuration :

    cache_type: doctrine
    entity_manager: doctrine.orm.entity_manager

doctrine.orm.entity_manager is the name of the doctrine connection you are using to store the data.

Do not forget to create the table linked to the AdBack sdk.

Custom

If you want to write your own cache driver, you should create a class that implements Adback\ApiClient\Driver\ScriptCacheInterface and name this service adback_api_client.script_cache.

In the config/packages/adback_sdk_php.yaml you should add the following configuration :

    cache_type: custom

If the service is missing, an error will be issued by the Symfony DIC when the service is being used.

Symfony < 4

In your app/config/config.yml file, you should add the following lines :

    adback_api_client:
        access_token: "your-access-token"

Modify it with the token provided by the AdBack team.

Then follow the paragraph linked to the type of cache you have choosen :

Redis

In the app/config/config.yml you should add the following configuration :

    adback_api_client:
        cache_type: redis
        cache_service: redis_service

redis_service is the name of the redis connection you are using to store the data.

Doctrine

In the app/config/config.yml you should add the following configuration :

    adback_api_client:
        cache_type: doctrine
        entity_manager: doctrine.orm.entity_manager

doctrine.orm.entity_manager is the name of the doctrine connection you are using to store the data.

Do not forget to create the table linked to the AdBack sdk.

Custom

If you want to write your own cache driver, you should create a class that implements Adback\ApiClient\Driver\ScriptCacheInterface and name this service adback_api_client.script_cache.

In the app/config/config.yml you should add the following configuration :

    adback_api_client:
        cache_type: custom

If the service is missing, an error will be issued by the Symfony DIC when the service is being used

Script Type

There is two possibilities for the script you could get.

Small scripts

This configuration will only load the AdBack script from an external url.

This usage is good for a quick start.

Full scripts

This configuration will load our full script or bootscrap script.

This will allow us to deliver a script which is more flexible when the blocking in place are harder.

This solution is recommanded for an advanced usage.

Usage

Refresh command

In order to have the AdBack script always up-to-date you should launch the command adback:api-client:refresh-tag periodically (at least once a day).

This command will call our api and store the response in the cache type you have chosen

Add the script to your pages

At the bottom of your webpages, you should add the script twig generation function :

    {{ adback_generate_scripts() }}

Full configuration description

    adback_api_client:
        access_token:         ~ # Required, Your personnal access token
        api_url:              'https://adback.co/api' # The base url for the api
        script_url:           script/me # The api url used to get the script
        cache_type:           redis # The cache type you are using
        generator_type:       script # The type of script you are generating
        cache_service:        redis # The service used for the caching
        entity_manager:       doctrine.orm.entity_manager # The entity manager used (only if you use the doctrine cache

        # This key is used if multiple website access the same database
        key_prefix:           ''

adback/adback-sdk-php-symfony 适用场景与选型建议

adback/adback-sdk-php-symfony 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 10.61k 次下载、GitHub Stars 达 2, 最近一次更新时间为 2017 年 07 月 13 日, 在 PHP 生态内属于活跃度较高的组件。

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

围绕 adback/adback-sdk-php-symfony 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-07-13