guibranco/pancake
Composer 安装命令:
composer require guibranco/pancake
包简介
The Pancake project, a toolkit for PHP projects
README 文档
README
A lightweight, composable toolkit for PHP 8.4+ projects.
📖 Documentation: guibranco.github.io/pancake
Table of contents
Features
Pancake provides a curated set of battle-tested utility classes, ready to drop into any PHP project:
| Class | Description |
|---|---|
CircuitBreaker |
Prevents cascading failures with open/half-open/closed state management |
Color |
Color conversion and manipulation utilities |
Database |
Thin PDO wrapper with query building helpers |
GUIDv4 |
RFC 4122-compliant UUID v4 generator |
GitHub |
Interact with the GitHub REST API |
HealthChecks |
Liveness and readiness probe endpoints |
IpUtils |
IP address parsing, validation, and range checking |
Logger |
PSR-3 compatible structured logger |
LogStream |
Real-time log ingestion and streaming client |
MemoryCache |
Shared-memory key/value store backed by shmop |
OneSignal |
Push notification client for the OneSignal API |
Request |
Fluent HTTP client with curl_multi support |
SessionManager |
Secure session handling with lifetime and flash support |
ShieldsIo |
Shields.io badge builder with cache-control |
CI/CD
| Build | Last commit | Coverage | Code smells | Lines of code |
|---|---|---|---|---|
Code quality
Installation
Requirements: PHP 8.4+, Composer
Via Composer (recommended)
composer require guibranco/pancake
Via GitHub Releases
Download the latest archive from the Releases page and include the autoloader manually.
User guide
Full documentation, class references, and examples live at guibranco.github.io/pancake.
Quick start
<?php require 'vendor/autoload.php'; use GuiBranco\Pancake\CircuitBreaker; use GuiBranco\Pancake\MemoryCache; use GuiBranco\Pancake\Request; // Protect an external API call with a circuit breaker $cb = new CircuitBreaker(new MemoryCache(), failureThreshold: 3, resetTimeout: 60); $result = $cb->execute(function () { $request = new Request(); return $request->get('https://api.example.com/data'); });
Testing
Requirements
- PHP 8.4+
- Composer
- MySQL / MariaDB running locally with the following config:
| Setting | Value |
|---|---|
| Host | localhost |
| Port | 3306 |
| User | root |
| Password | root |
| Database | pancake |
- WireMock for integration tests (see
docker-compose.yml)
Running the test suite
# Install dependencies composer install # Start WireMock (required for integration tests) docker compose up -d # Run all tests ./vendor/bin/phpunit tests # Run only unit tests ./vendor/bin/phpunit tests/Unit # Run only integration tests ./vendor/bin/phpunit tests/Integration
Changelog
See CHANGELOG for the full history of releases and changes.
Contributing
Contributions are welcome! Please read CONTRIBUTING.md before opening a pull request.
Contributors
|
Guilherme Branco Stracini |
Gabriel Goulart |
Haraprasad Mondal |
Sheikh Humayun Roshid |
Bots
|
dependabot[bot] |
github-actions[bot] |
gitauto-ai[bot] |
deepsource-autofix[bot] |
penify-dev[bot] |
Snyk Bot |
Support
Please open an issue for bug reports, feature requests, or questions.
Copyright © Guilherme Branco Stracini. Released under the MIT License.
统计信息
- 总下载量: 16.15k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-03-19
