Download the PHP package mostafaaminflakes/dual-optimus without Composer
On this page you can find all versions of the php package mostafaaminflakes/dual-optimus. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mostafaaminflakes/dual-optimus
More information about mostafaaminflakes/dual-optimus
Files in mostafaaminflakes/dual-optimus
Package dual-optimus
Short Description Dual Optimus - ID obfuscation with 64-bit support while maintaining 32-bit compatibility
License MIT
Homepage https://github.com/mostafaaminflakes/dual-optimus
Informations about the package dual-optimus
Dual Optimus
A powerful PHP package that extends Jenssegers\Optimus to support both 64-bit and 32-bit ID obfuscation with intelligent auto-detection, multiple connections, and seamless Laravel integration.
โจ Features
- ๐ง Built on Jenssegers\Optimus: Leverages the proven and battle-tested 32-bit implementation
- ๐ Dual Bit Support: Seamlessly handles both 32-bit and 64-bit integers with automatic detection
- ๐ 100% Backward Compatible: Drop-in replacement for existing Jenssegers\Optimus implementations
- ๐ Multiple Connections: Configure and use multiple Optimus instances for different use cases
- ๐ง Intelligent Auto-Detection: Automatically selects the appropriate bit size based on input value
- ๐ฏ Laravel Ready: Complete Laravel integration with service provider, facade, and configuration
- โก High Performance: Optimized for speed with minimal overhead
- ๐งช Thoroughly Tested: Comprehensive PHPUnit test suite with Orchestra Testbench
- ๐ฆ Easy Installation: Simple Composer installation with auto-discovery
๐ Requirements
- PHP: 8.1 or higher
- Extensions:
ext-gmp(for 64-bit operations) - Dependencies:
jenssegers/optimus ^1.1 - Laravel: 10.0+ (optional, for Laravel integration)
๐ฆ Installation
Install the package via Composer:
Laravel Integration
The package automatically registers itself in Laravel 5.5+. For older versions, manually add to config/app.php:
Publish the configuration file:
โ๏ธ Configuration
Environment Variables
Add these variables to your .env file:
Configuration File
The published config/dual-optimus.php file contains:
๐ Usage
Basic Usage
Force 64-bit Operations
Multiple Connections
Direct Manager Usage
Access Underlying Optimus
๐ง Artisan Commands
Generate new Optimus keys:
๐งช Testing
Run the complete test suite:
Run tests with coverage report:
Run specific test suites:
๐ Migration from Jenssegers\Optimus
Dual Optimus is a 100% drop-in replacement for Jenssegers\Optimus:
All existing encoded values will decode correctly - no data migration required!
๐ Performance
Dual Optimus adds minimal overhead while providing significant functionality:
- 32-bit operations: Identical performance to Jenssegers\Optimus (uses it directly)
- 64-bit operations: Optimized GMP operations with caching
- Auto-detection: Simple integer comparison with negligible cost
- Memory usage: Minimal additional memory footprint
๐ก๏ธ Security Considerations
- Cryptographically Secure: Uses the same proven algorithms as Jenssegers\Optimus
- No Data Leakage: Values are obfuscated, not encrypted (reversible by design)
- Key Management: Store your prime/inverse/random values securely
- Environment Variables: Use
.envfiles and never commit keys to version control
๐ค Contributing
We welcome contributions! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Add tests for new functionality
- Ensure all tests pass (
composer test) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Development Setup
๐ Changelog
v1.0.0 - Initial Release
- โ 64-bit ID support with automatic detection
- โ Full backward compatibility with 32-bit IDs
- โ Multiple connections support
- โ Laravel service provider and facade
- โ Comprehensive test suite with 100% coverage
- โ Artisan command for key generation
๐ License
This package is open-sourced software licensed under the MIT License.
๐ Credits
- Mostafa Amin - Creator and maintainer
- Jens Segers - Original Optimus package
- All contributors who help improve this package
๐ Support
- Documentation: GitHub Wiki
- Issues: GitHub Issues
- Discussions: GitHub Discussions
Made with โค๏ธ for the PHP community