lifestyle/ sulu-template-api-bundle
1.2.0
2019-04-11 09:44 UTC
Requires
- php: ^7.2
- jackalope/jackalope-doctrine-dbal: ^1.3
- jackalope/jackalope-jackrabbit: ^1.3
- sulu/sulu: ^1.6
- symfony/config: ^3.4|^4.1
- symfony/dependency-injection: ^3.4|^4.1
- symfony/http-kernel: ^3.4|^4.1
Requires (Dev)
- fzaninotto/faker: ^1.8
- phpunit/phpunit: ^8.0
- symfony/phpunit-bridge: ^3.4|^4.1
- symfony/var-dumper: ^3.4|^4.1
This package is not auto-updated.
Last update: 2020-07-30 16:28:06 UTC
README
... 用于 Sulu CMS。
需求
- Sulu 版本 1.6
- PHP7.2
安装
composer require lifestyle/sulu-template-api-bundle
1. 将以下代码添加到抽象内核 app/AbstractKernel.php
abstract class AbstractKernel extends SuluKernel
{
public function registerBundles()
{
$bundles = [
...
new LifeStyle\Sulu\TemplateApiBundle\LifeStyleSuluTemplateApiBundle(),
...
];
...
}
...
}
2. 添加路由 app/config/website/routing.yml
life_style_api_route:
resource: "@LifeStyleSuluTemplateApiBundle/Resources/config/routing.yml"
prefix: /
3. 将配置添加到您的 app/config/config.yml
life_style_sulu_template_api:
available_languages: ['de', 'en']
header_template: '@LifestyleSuluTemplate/templates/includes/header/header.html.twig'
footer_template: '@LifestyleSuluTemplate/templates/includes/footer/footer.html.twig'
4. 示例请求
GET http://your-domain.tld/{locale}/api/template.json
5. 示例响应
{
"scriptTimeSec": 0.5397,
"locale": "de",
"webspace": "sulu-webspace-name",
"headerHtml": "some html markup",
"footerHtml": "some html markup"
}
祝你好运,玩得开心!