modernman00/shared-lib
最新稳定版本:v1.8.19
Composer 安装命令:
composer require modernman00/shared-lib
包简介
Shared library for common functions and classes across projects
README 文档
README
A comprehensive PHP shared library containing common functions and classes for use across multiple projects.
Features
- Authentication & Security: JWT handling, secure sessions, token management
- Database Operations: PDO utilities, query builders, database helpers
- Form Building: Bootstrap and Bulma form builders
- File Management: Upload handling, image optimization, virus scanning
- Email Services: PHPMailer integration, email templates
- Validation & Sanitization: Input validation, data sanitization
- Rate Limiting: Request throttling and rate limiting
- Logging: Monolog integration for structured logging
- Exception Handling: Custom exception classes
Installation
Install via Composer:
composer require waleolaogun/shared-lib
Requirements
- PHP 8.1 or higher
- Composer for dependency management
Usage
Basic Example
<?php require_once 'vendor/autoload.php'; use Src\Auth; use Src\Db; use Src\Utility; // Initialize database connection $db = new Db(); // Use authentication $auth = new Auth($db); // Use utility functions $sanitized = Utility::sanitizeInput($_POST['data']);
Available Classes
Src\Auth- Authentication and authorizationSrc\Db- Database operations and utilitiesSrc\Email- Email sending capabilitiesSrc\FileUploader- File upload handlingSrc\JwtHandler- JWT token managementSrc\Limiter- Rate limiting functionalitySrc\Utility- General utility functions- And many more...
Development
Setting Up Development Environment
-
Clone the repository:
git clone https://github.com/modernman00/shared-lib.git cd shared-lib -
Install dependencies:
composer install
-
Run code quality checks:
# PHP CS Fixer vendor/bin/php-cs-fixer fix --dry-run --diff # PHPStan static analysis vendor/bin/phpstan analyse
Code Quality Standards
This project follows PSR-12 coding standards and uses:
- PHP CS Fixer for code formatting
- PHPStan for static analysis (Level 6)
- Composer audit for security vulnerability scanning
CI/CD Pipeline
The project uses GitHub Actions for continuous integration and deployment:
- Automated Testing: Runs on PHP 8.1, 8.2, and 8.3
- Code Quality Checks: PHP CS Fixer and PHPStan analysis
- Security Scanning: Dependency vulnerability checks
- Automated Dependency Updates: Dependabot integration
- Release Management: Automated release asset creation
Contributing
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Make your changes and ensure they pass all quality checks
- Commit your changes:
git commit -m 'Add amazing feature' - Push to the branch:
git push origin feature/amazing-feature - Open a Pull Request
All pull requests are automatically tested against our CI pipeline.
Running Tests Locally
# Install development dependencies composer install --dev # Run PHP CS Fixer vendor/bin/php-cs-fixer fix --dry-run --diff --verbose # Run static analysis vendor/bin/phpstan analyse --memory-limit=1G # Check for security vulnerabilities composer audit
Versioning
This project uses Semantic Versioning. For available versions, see the releases page.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Support
For support, please open an issue on the GitHub repository.
Changelog
For a detailed changelog, see RELEASES.
统计信息
- 总下载量: 3
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-07-28