承接 fusionary/craftcms-bootstrap 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

fusionary/craftcms-bootstrap

Composer 安装命令:

composer require fusionary/craftcms-bootstrap

包简介

Craft CMS Bootstrap

README 文档

README

Boot by Ben Davis from the Noun Project

What it does

Reduces boilerplate for bootstrapping and configuration by abstracting common tasks to a simple api. Used by Fusionary's Craft CMS Boilerplate.

Bootstrap

e.g @webroot/index.php

  • Reduces your app bootstrap boilerplate code to a single chainable statement.
    • This is especially helpful for achieving consistency when dealing with multiple access points (e.g. multi-site, console app)
  • Sets PHP constants, with sensible fallbacks.
  • Gracefully loads .env file environment variables.

Configuration files

e.g. @root/config/general.php or any configuration files

  • Retrieves environment variables with fallbacks and content-aware type conversion. For example:
    • export MY_BOOL=truebool
    • export MY_INT=3int
  • Provides access to HTTP request headers (via yii\web\Request), should your configuration rely on it.
  • Provides method to map your entire config to any matching/prefixed environment variables.
    • For example, $config['allowAutoUpdates'] will match CRAFT_ALLOW_AUTO_UPDATES from environment

Prerequisites

"php": ">=7.1.0",
"craftcms/cms": "^3.0.0-RC1",

Installation

composer require fusionary/craftcms-bootstrap

API Documentation

Class Reference / API Documentation

Examples

Web app

e.g. @root/public/index.php

<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
fusionary\craftcms\bootstrap\Bootstrap::run();

Multi-site web app

e.g. @root/public/site-handle/index.php

<?php
require_once dirname(__DIR__, 2) . '/vendor/autoload.php';
fusionary\craftcms\bootstrap\Bootstrap
    ->setDepth(2) // Set the depth of this script from your project root (`CRAFT_BASE_PATH`) to determine paths
    ->setSite('site-handle') // If the containing folder matches the site handle, you could dynamically set this with `basename(__DIR__)`
    ->run();

Console app

e.g. @root/craft

<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
exit(Bootstrap::run('console')->setDepth(0)->run()); // Override the default depth of 1, since this script is in `@root`.

Environment variable mapping

Passing your config through Config::mapMultiEnvConfig or Config::mapConfig will map all settings to corresponding environment variables (if they exist).

Settings are converted from their Craft/PHP versions (camel-case) to their environment variable versions (all-caps, snake-case, prefixed — e.g. CRAFT_, DB_).

General config

e.g. @root/config/general.php

<?php
// Example environment:
// export CRAFT_ALLOW_AUTO_UPDATES=true;

use fusionary\craftcms\bootstrap\helpers\Config;

return Config::mapMultiEnvConfig([
    '*' => [
        'allowAutoUpdates' => true,
        'someOtherSetting' => 'foo',

        // Example: get HTTP header from request
        'devServerProxy' => Config::getHeader('x-dev-server-proxy') ?? false,
    ],
    'production' => [
        'allowAutoUpdates' => false,
    ]
]);

// Result:
// return [
//  '*' => [
//    'allowAutoUpdates' => true,
//    'someOtherSetting' => 'foo'
//  ],
//  'production' => [
//    'allowAutoUpdates' => true
//  ]
// ];

Database config

e.g. @root/config/db.php

<?php
// Example environment:
// export DB_DRIVER=mysql
// export DB_SERVER=mysql
// export DB_USER=my_app_user
// export DB_PASSWORD=secret
// export DB_DATABASE=my_app_production
// export DB_SCHEMA=public

use fusionary\craftcms\bootstrap\helpers\Config;

// Pass prefix as 2nd argument, defaults to 'CRAFT_'
return Config::mapConfig([
  'driver' => null,
  'server' => null,
  'user' => null,
  'password' => null,
  'database' => null,
  'schema' => null,
], 'DB_');

// Result:
// return [
//   'driver' => 'mysql',
//   'server' => 'mysql',
//   'user' => 'my_app_user',
//   'password' => 'secret',
//   'database' => 'my_app_production',
//   'schema' => 'public',
// ]

Generate documentation

composer run-script build-docs

Acknowledgements

"Boot" icon by Ben Davis from The Noun Project

fusionary/craftcms-bootstrap 适用场景与选型建议

fusionary/craftcms-bootstrap 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 485 次下载、GitHub Stars 达 4, 最近一次更新时间为 2018 年 02 月 26 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「bootstrap」 「yii」 「Craft」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 fusionary/craftcms-bootstrap 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 fusionary/craftcms-bootstrap 我们能提供哪些服务?
定制开发 / 二次开发

基于 fusionary/craftcms-bootstrap 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

  • Stars: 4
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-02-26