k-kinzal/testcontainers-php
Composer 安装命令:
composer require k-kinzal/testcontainers-php
包简介
PHP library for Testcontainers
README 文档
README
A PHP implementation of Testcontainers that supports PHP versions from 5.6 to 8.5, including EOL versions. This library enables you to use Docker containers for your integration tests with minimal dependencies.
If you are using a supported PHP version, consider using the official testcontainers/testcontainers instead.
Features
- Supports PHP 5.6 to 8.5 (including EOL versions)
- Minimal dependencies for easy integration
- Complete container lifecycle management
- Various configuration options for containers
- Multiple wait strategies to ensure services are ready
- Support for remote Docker hosts and SSH port forwarding
Requirements
- Docker command line tool (docker CLI)
- PHP 5.6 or later
Installation
composer require --dev k-kinzal/testcontainers-php
Quick Start
<?php use PHPUnit\Framework\TestCase; use Testcontainers\Containers\GenericContainer\GenericContainer; use Testcontainers\Testcontainers; class MyContainer extends GenericContainer { protected static $IMAGE = 'alpine:latest'; } class MyTest extends TestCase { public function test(): void { // Start the container and get the container instance $instance = Testcontainers::run(MyContainer::class); // Your test code here // Containers are automatically stopped when the test ends } }
Documentation
For more detailed information, check out the documentation:
- Getting Started: A comprehensive guide to installing and using testcontainers-php
- Container Configuration: Learn how to configure containers with various settings
- Environments: Understand how to configure testcontainers-php using environment variables
- CI Setup: Guide for setting up testcontainers-php in CI environments (GitHub Actions, CircleCI)
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgements
- Testcontainers for the original concept and implementation in other languages
- All contributors who have helped improve this project
k-kinzal/testcontainers-php 适用场景与选型建议
k-kinzal/testcontainers-php 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 19.03k 次下载、GitHub Stars 达 6, 最近一次更新时间为 2025 年 03 月 04 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 k-kinzal/testcontainers-php 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 k-kinzal/testcontainers-php 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 19.03k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 6
- 点击次数: 2
- 依赖项目数: 4
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-03-04