modernman00 / shared-lib
Shared library for common functions and classes across projects
Requires
- cloudmersive/cloudmersive_virusscan_api_client: ^3.1
- eftec/bladeone: ^4.18
- firebase/php-jwt: ^6.11
- guzzlehttp/guzzle: ^7.9
- intervention/image: ^3.11
- monolog/monolog: ^3.9
- pelago/emogrifier: ^7.3
- phpmailer/phpmailer: ^6.9
- spatie/image-optimizer: ^1.6
- sunspikes/clamav-validator: ^3.0
- symfony/mailer: ^7.3
- symfony/rate-limiter: ^7.2.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.75
- mockery/mockery: ^1.6
- php-mock/php-mock: ^2.6
- php-mock/php-mock-phpunit: ^2.13
- phpstan/phpstan: ^1.10
- phpunit/phpunit: ^10.0
- dev-master
- v1.7.14
- v1.7.13
- v1.7.12
- v1.7.11
- v1.7.10
- v1.7.9
- v1.7.8
- v1.7.7
- v1.7.6
- v1.7.5
- v1.7.4
- v1.7.3
- v1.7.2
- v1.7.1
- v1.6.8
- v1.6.7
- v1.6.6
- v1.6.5
- v1.6.4
- v1.6.3
- v1.6.2
- v1.5.158
- v1.5.157
- v1.5.156
- v1.5.155
- v1.5.154
- v1.5.153
- v1.5.152
- v1.5.151
- v1.5.150
- v1.5.149
- v1.5.148
- v1.5.147
- v1.5.146
- v1.5.145
- v1.5.144
- v1.5.143
- v1.5.142
- v1.5.141
- v1.5.140
- v1.5.139
- v1.5.138
- v1.5.137
- v1.5.136
- v1.5.135
- v1.5.134
- v1.5.133
- v1.5.132
- v1.5.131
- v1.5.130
- v1.5.129
- v1.5.128
- v1.5.127
- v1.5.126
- v1.5.125
- v1.5.124
- v1.5.123
- v1.5.122
- v1.5.121
- v1.5.120
- v1.5.119
- v1.5.118
- v1.5.117
- v1.5.116
- v1.5.115
- v1.5.114
- v1.5.113
- v1.5.112
- v1.5.111
- v1.5.110
- v1.5.109
- v1.5.108
- v1.5.107
- v1.5.106
- v1.5.105
- v1.5.104
- v1.5.103
- v1.5.102
- v1.5.101
- v1.5.100
- v1.5.99
- v1.5.98
- v1.5.97
- v1.5.96
- v1.5.95
- v1.5.94
- v1.5.93
- v1.5.92
- v1.5.91
- v1.5.90
- v1.5.89
- v1.5.88
- v1.5.87
- v1.5.86
- v1.5.85
- v1.5.84
- v1.5.83
- v1.5.82
- v1.5.81
- v1.5.80
- v1.5.79
- v1.5.78
- v1.5.77
- v1.5.76
- v1.5.75
- v1.5.74
- v1.5.73
- v1.5.72
- v1.5.71
- v1.5.70
- v1.5.69
- v1.5.68
- v1.5.67
- v1.5.66
- v1.5.65
- v1.5.64
- v1.5.63
- v1.5.62
- v1.5.61
- v1.5.60
- v1.5.59
- v1.5.58
- v1.5.57
- v1.5.56
- v1.5.55
- v1.5.54
- v1.5.53
- v1.5.52
- v1.5.51
- v1.5.50
- v1.5.49
- v1.5.48
- v1.5.47
- v1.5.46
- v1.5.45
- v1.5.44
- v1.5.43
- v1.5.42
- v1.5.41
- v1.5.40
- v1.5.39
- v1.5.38
- v1.5.37
- v1.5.36
- v1.5.35
- v1.5.34
- v1.5.33
- v1.5.32
- v1.5.31
- v1.5.30
- v1.5.29
- v1.5.28
- v1.5.27
- v1.5.26
- v1.5.25
- v1.5.24
- v1.5.23
- v1.5.22
- v1.5.21
- v1.5.20
- v1.5.19
- v1.5.18
- v1.5.17
- v1.5.16
- v1.5.15
- v1.5.14
- v1.5.13
- v1.5.12
- v1.5.11
- v1.5.10
- v1.5.8.89
- v1.5.8.88
- v1.5.8.87
- v1.5.8.86
- v1.5.8.85
- v1.5.8.84
- v1.5.8.83
- v1.5.8.82
- v1.5.8.81
- v1.5.8.80
- v1.5.8.79
- v1.5.8.78
- v1.5.8.77
- v1.5.8.76
- v1.5.8.75
- v1.5.8.73
- v1.5.8.72
- v1.5.8.71
- v1.5.8.70
- v1.5.8.69
- v1.5.8.68
- v1.5.8.67
- v1.5.8.66
- v1.5.8.65
- v1.5.8.64
- v1.5.8.63
- v1.5.8.62
- v1.5.8.61
- v1.5.8.60
- v1.5.8.59
- v1.5.8.58
- v1.5.8.57
- v1.5.8.56
- v1.5.8.55
- v1.5.8.54
- v1.5.8.51
- v1.5.8.50
- v1.5.8.49
- v1.5.8.48
- v1.5.8.47
- v1.5.8.46
- v1.5.8.45
- v1.5.8.44
- v1.5.8.43
- v1.5.8.42
- v1.5.8.41
- v1.5.8.40
- v1.5.8.39
- v1.5.8.38
- v1.5.8.37
- v1.5.8.36
- v1.5.8.35
- v1.5.8.34
- v1.5.8.33
- v1.5.8.32
- v1.5.8.31
- v1.5.8.30
- v1.5.8.29
- v1.5.8.28
- v1.5.8.27
- v1.5.8.26
- v1.5.8.25
- v1.5.8.24
- v1.5.8.23
- v1.5.8.22
- v1.5.8.21
- v1.5.8.20
- v1.5.8.19
- v1.5.8.18
- v1.5.8.17
- v1.5.8.16
- v1.5.8.15
- v1.5.8.14
- v1.5.8.13
- v1.5.8.12
- v1.5.8.11
- v1.5.8.10
- v1.5.8.9
- v1.5.8.8
- v1.5.8.7
- v1.5.8.6
- v1.5.8.5
- v1.5.8.4
- v1.5.8.3
- v1.5.8.2
- v1.5.8.1
- v1.5.8
- v1.5.7
- v1.5.4
- v1.5.3
- v1.5.1
- v1.5.0
- v1.4.0
- v1.2.0
- v1.1.0
- v1.0.0
- dev-dependabot/composer/friendsofphp/php-cs-fixer-3.88.2
- dev-dependabot/composer/phpstan/phpstan-2.1.29
- dev-dependabot/composer/symfony/mailer-7.3.4
- dev-dependabot/composer/phpunit/phpunit-12.3.15
- dev-dependabot/composer/pelago/emogrifier-8.1.0
- dev-dependabot/composer/eftec/bladeone-4.19.1
- dev-dependabot/composer/guzzlehttp/guzzle-7.10.0
- dev-dependabot/github_actions/actions/checkout-5
- dev-dependabot/composer/intervention/image-3.11.4
- dev-dependabot/composer/symfony/rate-limiter-7.3.2
- dev-dependabot/github_actions/actions/cache-4
This package is auto-updated.
Last update: 2025-10-02 08:31:41 UTC
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.