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
git clone git@github.com:strategio-digital/rokuc-cz.git <my-project>rm -rf <my-project>/.git- Go to second step in "For contributors" and continue.
2. For contributors
git clone git@github.com:strategio-digital/contentio-sdk.git./project.sh serve./project.sh appcomposer icomposer analyseyarn && yarn dev
3. After installation
- Classic project: http://localhost:8080
- For contributors: http://localhost:1337
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 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 194
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: proprietary
- 更新时间: 2022-02-21