eastoriented / library
使用Docker设置库开发环境的蓝图
This package is auto-updated.
Last update: 2024-09-10 14:33:41 UTC
README
eastoriented/library
的目标是提供 PHP 开发环境,用于使用 docker
开发类。
它提供了一些默认的 git 文件,如 .gitignore
,README.md
的骨架,MIT 许可证文件,一个包含用于 docker
的 php
、composer
、docker-compose
和 atoum
脚本的 bin
目录。
此外,它使用 atoum
设置测试环境,并允许用户轻松切换 PHP 版本并相应地更新 vendor
目录。
最后,它提供了一个 Makefile
来执行测试、更新供应商、管理版本、重新生成自动加载等。
特性
- 一行命令即可安装;
- 使用 docker 设置 PHP 开发环境,因此与工作站上安装的软件完全独立;
- 允许用户“实时”切换 PHP 版本(默认支持 PHP 7.1、7.2、7.3、7.4 和 8)并自动更新相应的
vendor
目录; - 可以自动根据上一个版本使用 semver 标记版本;
- 使用 atoum 设置测试环境;
- 提供各种 CI 的配置文件(目前为 Github Action、Travis-CI 和 Gitlab CI);
- 设置一个 pre-commit 钩子来运行单元测试;
- 在
bin
目录中提供composer
、php
、atoum
和docker-compose
的 docker 包装器; - 允许用户根据当前提交或标记轻松发布;
- 定义配置以在 docker 环境中透明地使用 SSH 密钥与
composer
; - 提供用于 VIM 插件
localvimrc
的.lvimrc
文件的支持; - 初始化 git 仓库;
- 提供默认的
.gitattributes
和.gitognore
文件; - 提供默认的 MIT 许可证文件;
- 提供默认的 README.md;
- 提供默认的 VERSION 文件;
- 在 OSX 和 Linux 上运行;
- 默认支持自定义 PHP 镜像;
- 易于更新;
- 使用
composer
缓存目录。
要求
使用 eastoriented/library
的要求是
安装
在终端中执行以下命令
wget -O - https://raw.githubusercontent.com/eastoriented/library/master/install.sh | sh
在过程结束时,您将获得一个包含开发 PHP 类所需所有文件的目录结构:默认情况下,将定义一个 github action 工作流程,但如果您想创建 .gitlab-ci.yml
,只需做
wget -O - https://raw.githubusercontent.com/eastoriented/library/master/install.sh | env WITH_GITLAB=true sh
Travis-CI 也受支持
wget -O - https://raw.githubusercontent.com/eastoriented/library/master/install.sh | env WITH_TRAVIS=true sh
如果您使用 Github Action,则必须将 COVERALLS_REPO_TOKEN
定义为 仓库秘密。
如果您使用 vim 和 localvimrc,您可以这样做
wget -O - https://raw.githubusercontent.com/eastoriented/library/master/install.sh | env WITH_VIM=true sh
在这种情况下,您必须编辑 ./.lvimrc
以定义 PHP 命名空间,有关更多信息,请参阅 .lvimrc
的内容。
如果您想使 composer
使用您的 SSH 凭据在某些仓库上具有 SSH 访问权限,只需做
wget -O - https://raw.githubusercontent.com/eastoriented/library/master/install.sh | env WITH_SSH=true sh
可以得到 docker-compose.yml
和基本的 Dockerfile,以构建自定义 PHP 镜像(添加扩展等)
wget -O - https://raw.githubusercontent.com/eastoriented/library/master/install.sh | env WITH_PHP_DOCKERFILES=true sh
最后但同样重要的是,可以混合所有 WITH_*
变量
wget -O - https://raw.githubusercontent.com/eastoriented/library/master/install.sh | env WITH_VIM=true WITH_SSH=true WITH_TRAVIS=true sh
更新
要获取最新版本,只需执行 make vendor/update
并提交你 Git 仓库中的所有更新文件。
如何使用它?
在终端中执行 make help
。
休斯顿,我们遇到了一个问题!
如果在遇到问题,请尝试以调试模式重新安装
wget -O - https://raw.githubusercontent.com/eastoriented/library/master/install.sh | env WITH_DEBUG=true sh | tee install.log
之后,打开一个 问题 并提供 install.log
文件的内容
提示
命令 eval $(make session)
将 bin
目录添加到你的当前 shell 会话的路径中,这样你就可以执行 php -v
,而 bin/php
将透明地被调用。