rapidez/strapi 问题修复 & 功能扩展

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

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

rapidez/strapi

最新稳定版本:4.0.0

Composer 安装命令:

composer require rapidez/strapi

包简介

Rapidez Strapi

关键字:

README 文档

README

Requirements

A Strapi instance running, configured and filled with content types.

Installation

composer require rapidez/strapi

Add the Strapi url to your .env:

STRAPI_URL=http://localhost:1337

Routes

Register some routes within routes/web.php and use the strapi() helper function to get the data. This function accepts the endpoint as parameter and just calls that endpoint and caches the response. For example:

Route::get('blog', function ($location) {
    return view('strapi.blog', ['data' => strapi('blogs')])
});

Route::get('blog/{slug}', function ($slug) {
    return view('strapi.blog-item', ['data' => strapi('blogs?slug='.$slug)[0]])
});

And use the data in your views. For example with {{ $data->name }} you'll get the content of the name field.

Dynamic zones

When you're using a dynamic zone within your content type you can render them with a Blade directive:

@dynamiczone($data->content)

This tries to render views with the same name as the component and the data will be available with the $data variable.

There is also a possibility to pass extra data to the template. For this you can pass an array as the second parameter:

@dynamiczone($data->content, ['foo' => 'bar', 'article' => $data])

The above example makes the variables $foo and $article available in the template

Cache

By default all responses from Strapi will be cached for 1 hour. You can change that with STRAPI_CACHE in your .env

Automatic cache clearing

You can setup a webhook within Strapi which will be called when something changes. If you configure that with the cache clear url from Rapidez you don't have to worry about content not showing up after changes. See the Rapidez cache docs.

License

GNU General Public License v3. Please see License File for more information.

统计信息

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

GitHub 信息

  • Stars: 4
  • Watchers: 2
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-3.0-or-later
  • 更新时间: 2021-10-06

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固