blackcube/core
最新稳定版本:3.6.0
Composer 安装命令:
composer require blackcube/core
包简介
Blackcube CMS Core system
README 文档
README
Pre-requisites
- PHP 8.2+
- Extension
dom - Extension
fileinfo - Extension
intl - Extension
json - Extension
mbstring - Extension
xmlreader - Extension
dom
- Extension
Pre-flight
Add blackcube core to the project
composer require "blackcube/core"
Installation
Beware:
Blackcube corecan be used in stand alone butBlackcube adminis recommended
Inject Blackcube core in application
// main configuration file 'container' => [ 'singletons' => [ // local filesystem blackcube\core\components\Flysystem::class => [ 'class' => blackcube\core\components\FlysystemLocal::class, 'path' => getstrenv('FILESYSTEM_LOCAL_PATH'), ], // or s3 blackcube\core\components\Flysystem::class => [ 'class' => blackcube\core\components\FlysystemAwsS3::class, 'key' => getstrenv('FILESYSTEM_S3_KEY'), 'secret' => getstrenv('FILESYSTEM_S3_SECRET'), 'bucket' => getstrenv('FILESYSTEM_S3_BUCKET'), 'region' => getstrenv('FILESYSTEM_S3_REGION'), 'version' => 'latest', 'endpoint' => getstrenv('FILESYSTEM_S3_ENDPOINT'), 'pathStyleEndpoint' => getboolenv('FILESYSTEM_S3_PATH_STYLE'), ], ] ], // ... 'bootstrap' => [ // ... boostrapped modules 'blackcube', // blackcube core ], 'modules' => [ // ... other modules 'blackcube' => [ 'class' => blackcube\core\Module::class, 'plugins' => [ // additional plugins ], 'cmsEnabledmodules' => [ // additional modules ], 'allowedParameterDomains' => ['], // override components if needed 'components' => [ 'db' => ... 'cache' => ... 'fs' => ... ], /// end override ], ], // ...
Update DB
Add needed tables in DB
php yii.php migrate
Init database with basic stuff
php yii.php bc:init
Blackcube core is now ready, you can use it
Add translations for new code
Managing translations can be a little tricky, here is a way to do it:
Prepare msgconfig.php
msgconfig.php is a configuration file for yii message command, it should be located in the root of the project.
return [ // string, required, root directory of all source files 'sourcePath' => __DIR__ . DIRECTORY_SEPARATOR . 'src', // array, required, list of language codes that the extracted messages // should be translated to. For example, ['zh-CN', 'de']. 'languages' => ['en'], // string, the name of the function for translating messages. // Defaults to 'Yii::t'. This is used as a mark to find the messages to be // translated. You may use a string for single function name or an array for // multiple function names. 'translator' => 'Module::t', // boolean, whether to sort messages by keys when merging new messages // with the existing ones. Defaults to false, which means the new (untranslated) // messages will be separated from the old (translated) ones. 'sort' => false, // boolean, whether to remove messages that no longer appear in the source code. // Defaults to false, which means these messages will NOT be removed. 'removeUnused' => false, // boolean, whether to mark messages that no longer appear in the source code. // Defaults to true, which means each of these messages will be enclosed with a pair of '@@' marks. 'markUnused' => true, // array, list of patterns that specify which files (not directories) should be processed. // If empty or not set, all files will be processed. // See helpers/FileHelper::findFiles() for pattern matching rules. // If a file/directory matches both a pattern in "only" and "except", it will NOT be processed. 'only' => ['*.php'], // array, list of patterns that specify which files/directories should NOT be processed. // If empty or not set, all files/directories will be processed. // See helpers/FileHelper::findFiles() for pattern matching rules. // If a file/directory matches both a pattern in "only" and "except", it will NOT be processed. 'except' => [ '.svn', '.git', '.gitignore', '.gitkeep', '.hgignore', '.hgkeep', '/messages', ], /**/ // 'po' output format is for saving messages to gettext po files. 'format' => 'po', // Root directory containing message translations. 'messagePath' => dirname(__DIR__, 2) . DIRECTORY_SEPARATOR . 'src/i18n', // Name of the file that will be used for translations. 'catalog' => 'messages', // boolean, whether the message file should be overwritten with the merged messages 'overwrite' => true, /**/ ];
Execute the command
php yii.php message src/i18n/msgconfig.php
Once done, you can update the translations in src/i18n/en/messages.po
Beware:
src/i18n/en/messages.pois the only file that should be updated, move it tosrc/i18n/messages.potand revert backsrc/i18n/en/messages.poto its original state Change msgctxt "XXX" to msgctxt "blackcube/core/XXX" to match Blackcube core context insrc/i18n/messages.pot
mv src/i18n/en/messages.po src/i18n/messages.pot
git checkout src/i18n/en/messages.po
sed -i 's/msgctxt "([^"]+)"/msgctxt "blackcube\/core\/$1"/g' src/i18n/messages.pot
Once done, you can update/add translations in src/i18n/<lang>/messages.pousing poedit or any other tool.
Running tests
# once databe is installed and pre-populated with `php yii.php bc:init`
./vendor/bin/codecept run
blackcube/core 适用场景与选型建议
blackcube/core 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 927 次下载、GitHub Stars 达 2, 最近一次更新时间为 2021 年 07 月 10 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「cms」 「content management」 「core」 「yii」 「yii2」 「blackcube」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 blackcube/core 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 blackcube/core 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 blackcube/core 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A block that displays featured content - large image, title, description and link.
GraphQL authentication for your headless Craft CMS applications.
Set Links with a specific language parameter
Supercharged text field validation.
TYPO3 CMS extension to create gallery content element with preset crop ratios and pagination
Integrate with Snipcart.
统计信息
- 总下载量: 927
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 16
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: bsd-3-clause
- 更新时间: 2021-07-10