moodle/moodle-composer-scaffold
Composer 安装命令:
composer require moodle/moodle-composer-scaffold
包简介
A scaffolding tool for Composer-based Moodle installations
README 文档
README
The Moodle Composer Scaffolder is a Composer Plugin intended to simplify and easy the installation of Moodle as a Composer project.
This tooling will:
- Generate a Moodle configuration file
- Support the generation of Configuration for Moodle
- Assist with the installation of Moodle
Files generated
The Moodle configuration
This tooling will guide you through the creation of a configuration file for Moodle which sits alongside your composer.json.
Placeholders
The following placeholders may be provided either in response to interactive prompts, or via the environment variable configuration:
| Placeholder | Meaning | Default |
|---|---|---|
[NAME] |
The name of the site | The base name of the folder that the project is in |
Configuration
You can provide a .env file in any of the following locations:
.envin your project's root directory.env.localin your project's root directory.envin the parent directory of you project.env.localin the parent directory of you project
The following parameters are accepted:
| Environment key | Default | Description | Placeholders | Example |
|---|---|---|---|---|
MOODLE_AGREE_LICENSE |
N |
Whether you agree to the Moodle GPL License agreement | - | Y |
MOODLE_ADMIN_PASSWORD |
- | The admin password to use when installing your site | - | password |
MOODLE_ADMIN_EMAIL |
- | The email address of the admin user | - | admin@example.com |
MOODLE_DB_USERNAME |
- | The username to use for the database server | - | webdev |
MOODLE_DB_PASSWORD |
- | The password to use for the database server | - | moodle |
MOODLE_DB_HOST |
- | The hostname to use for the database server | - | localhost |
MOODLE_DB_NAME |
[NAME] |
The name of the database to use | [NAME] |
[NAME] |
MOODLE_DB_PREFIX |
mdl_ |
The database prefix to use | - | mdl_ |
MOODLE_DB_DRIVER |
- | The database driver to use | - | pgsql |
MOODLE_WWWROOT |
- | The URL of the Moodl esite | [NAME] |
https://[NAME].example |
Generated files
Moodle Configuration - /config.php
The root /config.php file stores all of the standard Moodle configuration properties.
This is functionally equivalent to the config.php in the standard installation and the values and documentation in config-dist.php apply here.
Note: There is no need to manually include the setup.php file as in the non-Composer installation method.
This file will only be generated if it does not already exist, but will be attempted on every Composer operation, or whenever the composer scaffold or composer configure commands are run.
Moodle Configuration Shim - /moodle/config.php
The scaffolder will create a config.php within the Moodle installation directory.
The purpose of this is to act as a shim for parts of Moodle which manually load the configuration file.
It will be generated on every Composer operation, or whenever the composer scaffold command is run.
Moodle Composer Autoload Shim - /moodle/vendor/autoload.php
The scaffolder will create a /moodle/vendor/autoload.php file which will load the Composer Autoload file from the project root.
This is required because in instances where Moodle is symlinked to the target directory (for example when using a Local Composer repository) the symlink source cannot be determined automatically from Moodle.
It will be generated on every Composer operation, or whenever the composer scaffold command is run.
Moodle Binary Helper - /msh
For versions of Moodle which support Console commands, a helper is created at /msh in the project root to link to the bin/moodle within the project root.
It will be generated on every Composer operation, or whenever the composer scaffold command is run.
Commands
The scaffolder includes several commands which can be manually run if required.
composer scaffold
This command will manually run the scaffold system.
Note: This is automatically called as a post-installation step any time that a package is installed or updated.
composer configure
This command will run the configuration wizard to create an initial manual configuration file.
If a configuration file already exists, it has no effect.
Note: This is automatically called as a post-installation step any time that a package is installed or updated.
References
This plugin was inspired by the Drupal Composer Scaffolder.
moodle/moodle-composer-scaffold 适用场景与选型建议
moodle/moodle-composer-scaffold 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 11.42k 次下载、GitHub Stars 达 5, 最近一次更新时间为 2026 年 01 月 21 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 moodle/moodle-composer-scaffold 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 moodle/moodle-composer-scaffold 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 11.42k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 5
- 点击次数: 4
- 依赖项目数: 3
- 推荐数: 0
其他信息
- 授权协议: GPL-3.0-or-later
- 更新时间: 2026-01-21