plan-com/docker-generator
Composer 安装命令:
composer require plan-com/docker-generator
包简介
A PHP library to generate Docker files via an Artisan command.
README 文档
README
Laravel package that provides an Artisan command to quickly generate all the essential Docker configuration files.
Included php 8.3, mysql, nginx, redis and xdebug enabled. Good alternative for sail when you want to have more controller
Features
- Single Artisan Command: Run one command to generate your complete Docker configuration.
- Dynamic Placeholder Replacement: Replace the
{{prefix}}placeholder in your stub files with a custom project prefix. - No Extra Configuration Needed: Uses the built-in stubs contained in the package.
- Seamless Laravel Integration: Perfectly designed for Laravel applications.
- Tested and Reliable: Comprehensive tests ensure the command works as expected in your application.
Installation
Add the package to your Laravel project using Composer:
composer require plan-com/php-docker-generator
Usage
Generate files
php artisan generate:docker {prefix}
Replace {prefix} with your desired project prefix. For example, if you want to prefix all container names with myproject, run:
php artisan generate:docker myproject
Remove Files(clean project)
php artisan remove:docker-generator
Build docker environment after
Handful make commands included for project management.
make build # first command to run to actually build docker envoirenment
make composer-install
make migrate
make migrate-test
make phpstan #requires phpstan installed
What Happens When You Run the Command
Stub Files Are Loaded:
The command loads the built-in stub files from the package's stubs/ directory. These files include:
docker-compose.yml.stub
Dockerfile.stub
Makefile.stub
.env.docker.dist.stub
Dynamic Replacement:
In each stub, every occurrence of {{prefix}} is replaced with the value you provide (myproject in this example).
File Generation:
The processed files are then written to your Laravel application's file system in the following locations:
docker-compose.yml – Located in the root directory, this file defines your Docker services with names incorporating the provided prefix.
docker/basic/Dockerfile – Located in a subdirectory (i.e. docker/basic/), this file contains the Docker build instructions for your PHP container.
Makefile – Placed at the project root, it includes commands (e.g., for running Docker and Artisan operations) that reference your prefixed service names.
.env.docker.dist – Also in the project root, this file acts as a template for any environment variables needed by your Docker configuration.
Overriding some variables
In .env.docker.dist there are some variables you can use in .env file like
COMPOSE_PROJECT_NAME - sets a name for docker environment project name
DOCKER_OUTPUT_DIR - sets where to put docker files like Dockerfile
plan-com/docker-generator 适用场景与选型建议
plan-com/docker-generator 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 5.21k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 04 月 10 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 plan-com/docker-generator 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 plan-com/docker-generator 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 5.21k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-04-10