diversity_templating/diversity-php
最新稳定版本:1.0.4
Composer 安装命令:
composer require diversity_templating/diversity-php
包简介
Engine for generic HTML components
README 文档
README
A PHP engine for Diversity components, by Textalk.
Diversity components search engine optimized (SEO) web components, specified by mustache templates, supporting dependencies, backend fetching of data over JSON-RPC, supporting AngularJS templating on the frontend (by doing collected manual bootstrapping).
This component system is constructed for use with Textalk Webshop, but is in no way limited to that use.
Using
-
Add composer dependency:
"diversity_templating/diversity-php": "1.0" -
"Use" it:
use Diversity\Factory\Api; use Diversity\Collection; use SAI\System\Curl;
- Add a component to your page:
$curl = new Curl; $factory = new Api('https://api.diversity.io/', $curl); $component = $factory->get('test', '1.2.3'); echo $component->render();
- Use a
Collectionto handle script loading:
$curl = new SAI\System\Curl; $factory = new Api('https://api.diversity.io/', $curl); $collection = new Collection; $collection->add($component = $factory->get('test', '1.2.3')); ?> <head> <? if ($collection->needsAngular()) {?> <script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.15/angular.min.js"></script> <? } ?> <?= $collection->renderScriptTags() ?> <?= $collection->renderStyleTags() ?> </head> <body> <?= $component->render() ?> <?= $collection->renderAngularBootstrap() ?> </body>
Developer install
Development depends on php, php-curl and php-xdebug.
# Will get composer, install dependencies and run tests make test
Changelog
1.0.0
- Using php-SAI 1.0.0.
0.3.0
- Factories are refactored; now you are supposed to instantiate a Factory-subclass, not Diversity\Factory directly.
0.2.0
- Handling arrays of styles.
License (MIT)
Copyright (C) 2014, 2015 Textalk AB fredrik.liljegren@textalk.se
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
See COPYING.
统计信息
- 总下载量: 2.75k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-05-12