定制 strategio/contentio-sdk 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

strategio/contentio-sdk

Composer 安装命令:

composer require strategio/contentio-sdk

包简介

PHP SDK for Contentio CRM websites

README 文档

README

(If you read this readme on npmjs.com, switch to https://github.com/strategio-digital/contentio-sdk)

About

  • Contentio-SDK is a fully extendable PHP & JS package for creating custom websites that's communicating with the Contentio REST API.

  • You can use it as "server-side-rendering (php)" AND "client-side-rendering (vue.js)" engine for your e-shop or website.

  • If you don't make any changes, the SDK will render a complete e-shop that will look exactly like https://contentio.store

Installation guide

1. For classic usage

You have to clone another repository rokuc-cz

  1. git clone git@github.com:strategio-digital/rokuc-cz.git <my-project>
  2. rm -rf <my-project>/.git
  3. Go to second step in "For contributors" and continue.

2. For contributors

  1. git clone git@github.com:strategio-digital/contentio-sdk.git
  2. ./project.sh serve
  3. ./project.sh app
  4. composer i
  5. composer analyse
  6. yarn && yarn dev

3. After installation

IMPORTANT NOTES FOR OUR CONTRIBUTORS

⚠️💥 Don't forget to yarn publish when you make changes in these 2 files:

    1. package.json
    2. yarn.lock

Examples for classic usage

1. Adding custom config file

In www/index.php

$container = (new Bootstrap())
    ->projectRootPath(__DIR__ . '/../')
    ->configure([
        __DIR__ . '/../vendor/strategio/contentio-sdk/config/app.neon',
        //__DIR__ . '/../config/app.neon' // <--- uncomment this
    ]);

$container->getByType(App::class)->run($container);

2. Overriding routes:

In app/config/app.neon

services:
    #routerFactory: Strategio\Router\RouterFactory # <--- uncomment this

In app/Router/RouterFactory.php

class RouterFactory extends \ContentioSdk\Router\RouterFactory
{
    public function createRoutes(): UrlMatcher
    {
        $routes = parent::createRoutes();
       
        // uncomment this --->
        /*$this->add('article_detail', '/clanky/{slug}', [
            \Strategio\Controller\ArticleController::class, 
            'index'
        ]);*/ 
        
        return $routes;
    }
}

3. Overriding template of any action

In app/Controller/ArticleController.php

class ArticleController extends \ContentioSdk\Controller\ArticleController
{
    #[Template(path: __DIR__ . '/../../view/controller/article.latte')]
    public function index(string $slug): void
    {
        parent::index($slug);
    }
}

4. Making async request to API

public function index(string $slug): void
{
    $this->addRequest('first', 'GET', "article/show-one", [
        'json' => [
            'slug' => $slug,
        ]
    ]);
    
    $this->addRequest('second', 'GET', "article/show-one", [
        'json' => [
            'slug' => $slug,
        ]
    ]);
    
    $responses = $this->dispatchRequests('Article Detail');
    
    // first article as array -->
    $a1 = json_decode($responses['first']->getBody()->getContents(), true);
    
    // second article as array -->
    $a2 = json_decode($responses['second']->getBody()->getContents(), true);
    
    $this->template->articles = [$a1, $a2];
}

5. Creating image thumbnail

{varType ContentioSdk\Component\Thumbnail\ThumbGen $thumbGen}
{var $thumb = $thumbGen->create('<slug>/article/56/test.png', 500, null, 'SHRINK_ONLY', 80)}
<img loading="lazy" src="{$thumb->getSrc()}" width="{$thumb->getWidth()}" height="{$thumb->getHeight()}" alt="...">

strategio/contentio-sdk 适用场景与选型建议

strategio/contentio-sdk 是一款 基于 Latte 开发的 Composer 扩展包,目前已累计 194 次下载、GitHub Stars 达 2, 最近一次更新时间为 2022 年 02 月 21 日, 在 PHP 生态内属于活跃度较高的组件。

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

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

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 0
  • 开发语言: Latte

其他信息

  • 授权协议: proprietary
  • 更新时间: 2022-02-21