aw-studio/laravel-strapi
Composer 安装命令:
composer require aw-studio/laravel-strapi
包简介
README 文档
README
A Laravel package to integrate with Strapi CMS, providing an elegant way to interact with Strapi models and components.
Installation
You can install the package via Composer:
composer require aw-studio/laravel-strapi
Configuration
After installation, publish the configuration file:
php artisan vendor:publish --tag=laravel-strapi-config
Then, add the following environment variables to your .env file:
STRAPI_BASE_URL=https://your-strapi-url.com STRAPI_CACHE_ACTIVE=true # Set to false to disable caching STRAPI_CACHE_TTL=3600 # Cache duration in seconds
Strapi Models
You can create Strapi models using the following command:
php artisan make:strapi-model {name}
This will create a SingleType or CollectionType model in App\Strapi\Models.
Querying Strapi Models
You can query models fluently:
$post = Post::locale('de') ->where('Slug', $slug) ->populate([ 'Image' => [ 'populate' => '*', ], ]) ->first();
Strapi Components
You can create Strapi components with the following command:
php artisan make:strapi-component {name?}
Each component represents a Strapi component (e.g., from dynamic zones). It consists of:
- A class file:
App\Strapi\Components\<CollectionName>\ComponentName.php - A corresponding Blade view file
Registering Components
Components must be registered in the config/laravel-strapi.php configuration file.
Populating Components
You can populate all components of a Content dynamic zone like this:
$post = Post::locale('de') ->where('Slug', $slug) ->populateContent() ->first();
Rendering Components in Blade
You can render dynamic zone components in Blade templates using the x-dynamiczone component:
<x-dynamiczone :items="$page->Content" />
License
This package is open-sourced software licensed under the MIT license.
aw-studio/laravel-strapi 适用场景与选型建议
aw-studio/laravel-strapi 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 102 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 03 月 11 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 aw-studio/laravel-strapi 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 aw-studio/laravel-strapi 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 102
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 14
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-03-11