PHP Package: hyperf/contract

Hyperf contract library provides interfaces for dependency injection and inversion of control. It enables efficient decoupling of components for better maintainability and testability.

Current Version: 3.2.0
Last Updated: 2025-09-10
PHP Requirement: >=8.2
Dependencies:
phpunit/phpunit
php-fig/container
⚠️ To ensure full functionality, the above dependencies might be required.

Package Description

Hyperf contract is a PHP library that facilitates the implementation of contracts for interfaces, making it easier to manage dependencies and improve code quality. By leveraging this library, developers can enforce contracts between classes, enhance code flexibility, and promote best practices in software design. With an emphasis on scalability and extensibility, Hyperf contract empowers developers to build robust and modular applications with ease.

📦 Show all available classes🔗 View on GitHub

Download Latest Version: 3.2.0

Download Download v3.2.0

Previous Versions

Code Integration Example

Make sure to include the correct namespace and class paths for proper usage.

<?php
// Example from PHPlibraries.com
require_once 'libs/hyperf/contract/3.2.0/loader.php';
require_once 'libs/sebastianbergmann/phpunit/12.4.1/loader.php';
require_once 'libs/php-fig/container/{lib_version}/loader.php';

use Hyperf\Contract\ContainerInterface;
use PHPUnit\Framework\TestCase;

$obj = new ContainerInterface();
echo '✅ Test OK: ' . get_class($obj);
?>

We aim to make using PHP packages easier without Composer. If something doesn't work, let us know — we'll fix it promptly.

Community Discussion

Ask questions, share tips, or report issues below.