3p5/bootstrap 问题修复 & 功能扩展

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

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

3p5/bootstrap

Composer 安装命令:

composer require 3p5/bootstrap

包简介

Bootstrap for WordPress project using Composer

README 文档

README

Bootstrap for WordPress project using Composer.

  1. Requirements
  2. Installation
  3. Configuration
  4. Development

Requirements

  • koodimonni/composer-dropin-installer
  • container (podman, docker)

Installation

Before reinventing the wheel, just check out our skeleton section for inspiration. Otherwise, follow reading :-)

Composer

Before installing the package you need to define the dropin paths in your composer.json. If you installed the package too early, just delete it from vendor folder. This will re-trigger the dropin-process.

The configuration in your composer.json should look something like this:

{
    "extra": {
        "config": {
            "allow-plugins": {
                "koodimonni/composer-dropin-installer": true
            }
        },
        "dropin-paths": {
            "public/": [
                "package:3p5/bootstrap:public/index.php,public/bootstrap.php,public/wp-config.php,public/wp-config-sample.php"
            ]
        }
    }
}

Now you can install the package from composer repository. For plugin/theme development, add --dev as argument.

composer require 3p5/bootstrap

Container

To auto-generate wp-config.php you need to add following to your entrypoint.sh:

if [ "$WP_ENV" != 'production' ]; then
    su -s /bin/sh - www-data -c '
        cd /srv/app;
        composer install --prefer-dist --no-progress --no-interaction;
        yarn install
    '
fi

if [ ! -f "public/content/wp-config.php" ]; then
    echo "Creating wp-config.php & generating salts"
    su -s /bin/sh - www-data -c '
        cd /srv/app;
        cp -a public/wp-config-sample.php public/content/wp-config.php;
        wp config shuffle-salts --config-file=public/wp-config.php
    '
fi

setfacl -R -m u:www-data:rwX -m u:"$(whoami)":rwX public/content
setfacl -dR -m u:www-data:rwX -m u:"$(whoami)":rwX public/content

BTW: For critical infrastructure it's not a bad idea to re-generate salts after each deployment. But to be honest, for that it's a worse idea relying on WordPress :-)

Configuration

Environments

It's possible using system environments and/or container secrets. For secrets, just suffix the environment variable with _FILE and the path to the file, e.g.:

DB_PASSWORD_FILE=/run/secrets/db_password

A full list of all environment variables is not available yet, please check src/Service/Configuration.php.

Trusted proxies

If you're using this application behind a reverse proxy (e.g. traefik), you need to set the trusted proxies to the CIDR of your proxy network. Otherwise you'll not get correct request scheme or client's real ip.

To set the trusted proxy, do something like this:

TRUSTED_PROXIES="172.0.0.0/24, 10.0.0.0/8, ..."

For testing, you can also set a wildcard (*).

Development

We're using some kind of git flow, so for merge requests please create a new branch from develop.

For consistency and security reasons, please run everything inside the container. Most tools are already pre-built in the dev-container.

  1. podman compose up -d
  2. podman exec -it -u www-data bootstrap_app_1 sh

WP-CLI

You can also use WP-CLI, switch to container and check following ./vendor/bin/wp --path=cms/ --url=https://localhost help

Permissions

If you're using podman in rootless mode (recommend), you'll for sure get permission issues while starting the container and also maybe while git interaction on host system. To fix permissions, you need to change the owner to your shadowed group id. Run following command with your specific gid (you can simply check inside your container):

sudo chown -R :${GID:-100081} .

To revert back, run following:

sudo chown -R ${USER}:${USER} .

PS: You should also be able to use podman unshare. Also, some IDEs support some automatic permission fixing while development. If you've found a better solution, feel free to improve this documentation :-)

3p5/bootstrap 适用场景与选型建议

3p5/bootstrap 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 480 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 05 月 19 日, 在 PHP 生态内属于活跃度较高的组件。

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

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

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

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: AGPL-3.0-only
  • 更新时间: 2025-05-19