Download the PHP package grazulex/php-semver-sieve without Composer
On this page you can find all versions of the php package grazulex/php-semver-sieve. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download grazulex/php-semver-sieve
More information about grazulex/php-semver-sieve
Files in grazulex/php-semver-sieve
Download grazulex/php-semver-sieve
More information about grazulex/php-semver-sieve
Files in grazulex/php-semver-sieve
Vendor grazulex
Package php-semver-sieve
Short Description A pure PHP package for checking if a version string is included in one or more version ranges. Supports SemVer 2.0.0 and multiple version dialects (Composer, npm, PyPI, etc.)
License MIT
Package php-semver-sieve
Short Description A pure PHP package for checking if a version string is included in one or more version ranges. Supports SemVer 2.0.0 and multiple version dialects (Composer, npm, PyPI, etc.)
License MIT
Please rate this library. Is it a good library?
Informations about the package php-semver-sieve
PHP SemVer Sieve
**Universal semantic version range checking across all major package managers - powerful, fast, and dependency-free PHP package.**
*A comprehensive library for evaluating version constraints from Composer, npm, PyPI, RubyGems, Maven, NuGet, Go modules, and more with a single unified API.*
[](https://packagist.org/packages/grazulex/php-semver-sieve) [](https://packagist.org/packages/grazulex/php-semver-sieve) [](https://github.com/Grazulex/php-semver-sieve/blob/main/LICENSE.md) [](https://php.net/) [](https://github.com/grazulex/php-semver-sieve/actions) [](https://github.com/grazulex/php-semver-sieve/actions) [](https://github.com/grazulex/php-semver-sieve/actions)
๐ Overview
A powerful, universal PHP package for checking if version strings match version ranges across all major package managers.
๐ฏ One API to rule them all - Handle version constraints from Composer, npm, PyPI, RubyGems, Maven, NuGet, Go modules, and more!
โจ Features
- ๐๏ธ Framework-agnostic - No Laravel or Composer dependencies
- ๐ Zero runtime dependencies - Pure PHP logic with performance focus
- ๐ SemVer 2.0.0 compatible - Follows semantic versioning specification
- ๐ 8 Package Manager Dialects - Universal support for all major ecosystems:
- ๐ PHP (Composer) -
^1.0,~1.2,>=1.0 <2.0 - ๐ฆ JavaScript (npm) - Special tags, workspace protocol, X-ranges
- ๐ Python (PyPI) - PEP 440 with dev/post releases, epochs
- ๐ Ruby (RubyGems) - Pessimistic constraints (
~>) - โ Java (Maven) - SNAPSHOT versions, range notation
- ๐ท C#/.NET (NuGet) - 4-segment versions, interval notation
- ๐น Go (Go modules) -
vprefix, pseudo-versions, incompatible versions - ๐ฏ Generic SemVer - Standards-compliant base implementation
- ๐ PHP (Composer) -
- ๐๏ธ SOLID Architecture - Clean, extensible, maintainable codebase
- ๐งช Fully tested - 42 tests, 126 assertions, mutation testing
- ๐ Static analysis - PHPStan level 6 compliant
- โก PHP 8.2+ - Modern features (readonly classes, enums, match expressions)
๐ Project Stats
- 24 source files with 3,600+ lines of code
- 42 passing tests with 126 assertions
- 8 complete dialects covering all major package managers
- Zero runtime dependencies for maximum compatibility
- 100% type coverage with PHPStan
Installation
๐ Quick Start
๐ฏ Universal Package Manager Support
๐ One API, All Ecosystems
๐ Dialect-Specific Features
๐ Composer Dialect (PHP)
๐ฆ npm Dialect (JavaScript/Node.js)
๐ PyPI Dialect (Python)
๐ RubyGems Dialect (Ruby)
โ Maven Dialect (Java)
๐ท NuGet Dialect (.NET)
๐น Go Modules Dialect
๐ฏ Generic SemVer Dialect
๐ Complete Syntax Reference
| Syntax | Example | Dialects | Description |
|---|---|---|---|
| Exact | 1.2.3 |
All | Exact version match |
| Comparators | >=1.0, <2.0, !=1.5 |
All | Greater/less than, not equal |
| Caret | ^1.2.3 |
Composer, npm, Generic | Compatible within major version |
| Tilde | ~1.2.3 |
Composer, npm, Generic | Compatible within minor version |
| Pessimistic | ~> 1.2 |
RubyGems | Ruby pessimistic constraint |
| Wildcards | 1.2.*, 1.x, * |
Most | Wildcard matching |
| X-Ranges | 1.2.x, 1.x.x |
npm | npm-style X-ranges |
| Hyphen Ranges | 1.2 - 1.4 |
Generic, Composer | Inclusive range |
| Interval | [1.0,2.0), (1.0,2.0] |
Maven, NuGet | Mathematical intervals |
| OR Logic | ^1.0 \|\| ^2.0 |
Most | Multiple range options |
| AND Logic | >=1.0 <2.0 |
Most | Combined constraints |
| Special Tags | latest, next, beta |
npm | Distribution tags |
| Workspace | workspace:*, workspace:^1.0 |
npm | Workspace protocol |
| Floating | 1.2.*, 1.* |
NuGet | Floating versions |
| Soft Req | 1.0+ |
Maven | Soft requirements |
| Qualifiers | 1.0-SNAPSHOT, 1.0-RELEASE |
Maven | Maven qualifiers |
| Compatible | ~=1.2 |
PyPI | PEP 440 compatible release |
| Arbitrary | ===1.2.3 |
PyPI | Arbitrary equality |
| v-prefix | v1.2.3 |
Go | Go module versions |
| 4-segment | 1.2.3.4 |
NuGet | .NET revision numbers |
๐ง Advanced Configuration
Configuration Options
Preset Configurations
๐จ Custom Dialects & Extensions
Creating Custom Dialects
Real-World Custom Dialect Example
๐จ Comprehensive Error Handling
๐๏ธ SOLID Architecture Deep Dive
Single Responsibility Principle (SRP)
Each class has one clear purpose:
Sieve- Main API facadeVersionParser- Parse version stringsRangeParser- Parse range expressionsVersionComparator- Compare versionsRangeEvaluator- Evaluate range matching
Open/Closed Principle (OCP)
- โ Add new dialects without modifying existing code
- โ Extend with new operators via configuration
- โ Plugin architecture for custom behaviors
Liskov Substitution Principle (LSP)
- โ
All dialects are interchangeable via
DialectInterface - โ Consistent behavior across implementations
- โ Polymorphic usage guaranteed
Interface Segregation Principle (ISP)
- โ Small, focused interfaces
- โ Clients depend only on methods they use
- โ No forced dependencies on unused functionality
Dependency Inversion Principle (DIP)
- โ Core classes depend on abstractions (interfaces)
- โ Dependency injection throughout
- โ High-level modules independent of low-level details
๐ Performance & Benchmarks
Optimizations
- Immutable objects - Thread-safe, cacheable
- Lazy evaluation - Parse only when needed
- Memory efficient - Minimal object allocation
- Type safety - PHP 8.2+ strict typing
Typical Performance
๐งช Testing & Quality Assurance
Test Coverage
- 42 tests with 126 assertions
- Unit tests for all components
- Integration tests for end-to-end scenarios
- Property-based testing for edge cases
- Mutation testing with Infection
Quality Tools
- PHPStan Level 6 - Static analysis
- PHP-CS-Fixer - PSR-12 code style
- Rector - Automated refactoring
- Pest - Modern testing framework
๐ผ Real-World Use Cases
๐ Dependency Analysis Tools
๐ฆ Package Registry & Mirrors
๐ CI/CD Pipeline Integration
๐ง Version Range Intersection
๐ Ecosystem Compatibility Matrix
| Feature | Generic | Composer | npm | PyPI | RubyGems | Maven | NuGet | Go |
|---|---|---|---|---|---|---|---|---|
| Basic Comparisons | โ | โ | โ | โ | โ | โ | โ | โ |
| Caret Ranges | โ | โ | โ | โ | โ | โ | โ | โ |
| Tilde Ranges | โ | โ | โ | โ | โ | โ | โ | โ |
| Pessimistic | โ | โ | โ | โ | โ | โ | โ | โ |
| Wildcards | โ | โ | โ | โ | โ | โ | โ | โ |
| X-Ranges | โ | โ | โ | โ | โ | โ | โ | โ |
| Interval Notation | โ | โ | โ | โ | โ | โ | โ | โ |
| Special Tags | โ | โ | โ | โ | โ | โ | โ | โ |
| 4+ Segments | โ | โ | โ | โ | โ | โ | โ | โ |
| v-Prefix Required | โ | โ | โ | โ | โ | โ | โ | โ |
| Prerelease Support | โ | โ | โ | โ | โ | โ | โ | โ |
๐ป Development & Contributing
๐ ๏ธ Local Development Setup
๐งช Development Commands
๐๏ธ Project Structure
๐ค Contributing
We welcome contributions! Here's how to get started:
๐ Quick Contribution Guide
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Write tests for your changes
- Run quality checks (
composer quality) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
๐ฏ Contribution Areas
- New dialects for other package managers
- Performance optimizations
- Additional test cases and edge case coverage
- Documentation improvements
- Bug fixes and issue resolution
๐ Coding Standards
- PSR-12 code style (enforced by PHP-CS-Fixer)
- PHPStan Level 6 compliance required
- 100% test coverage for new features
- SOLID principles architecture
- PHP 8.2+ modern features encouraged
๐งช Adding New Dialects
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
๐ Credits & Acknowledgments
๐จโ๐ป Author
Jean-Marc Strauven - Initial work and architecture
- GitHub: @Grazulex
- Email: [email protected]
๐ฏ Inspiration & References
- SemVer 2.0.0 Specification - The foundation for semantic versioning
- Composer (getcomposer.org) - PHP dependency management
- npm - Node.js package manager version handling
- PEP 440 - Python packaging version identification
- RubyGems - Ruby package manager conventions
- Maven - Java project management and versioning
- NuGet - .NET package management
- Go Modules - Go dependency management system
๐๏ธ Architecture Principles
- SOLID Principles - Clean, maintainable object-oriented design
- Domain-Driven Design - Value objects and ubiquitous language
- Immutable Objects - Thread-safe, predictable behavior
- Dependency Injection - Testable, flexible architecture
๐ ๏ธ Tools & Technologies
- PHP 8.2+ - Modern PHP with latest features
- Pest - Elegant PHP testing framework
- PHPStan - Static analysis for type safety
- Infection - Mutation testing for test quality
- PHP-CS-Fixer - Code style automation
- GitHub Actions - Continuous integration
**๐ PHP SemVer Sieve** - *Universal version range checking for the modern PHP ecosystem*
[](https://github.com/Grazulex/php-semver-sieve)
[](https://github.com/Grazulex/php-semver-sieve)
[](https://github.com/Grazulex/php-semver-sieve/issues)
Made with โค๏ธ for the PHP community
All versions of php-semver-sieve with dependencies
PHP Build Version
Package Version
Requires
php Version
^8.2
The package grazulex/php-semver-sieve contains the following files
Loading the files please wait ...