PHP Package: phpspec/prophecy

PHP library for creating mock objects in tests efficiently and effectively.

Current Version: 1.20.0
Last Updated: 2024-11-19
PHP Requirement: ^7.2 || 8.0.* || 8.1.* || 8.2.* || 8.3.* || 8.4.*
Dependencies:
phpspec/prophecy-phpunit
phpunit/phpunit
⚠️ To ensure full functionality, the above dependencies might be required.

Package Description

Prophecy is a PHP library that enables developers to create mock objects with a more intuitive and flexible approach. With Prophecy, you can easily mock dependencies, define method calls, and manage return values for testing purposes. It provides a clean and readable syntax for mocking objects, making testing more efficient and productive in your PHP projects.

📦 Show all available classes🔗 View on GitHub

Download Latest Version: 1.22.0

Clock Coming soon

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/phpspec/prophecy/1.22.0/loader.php';
require_once 'libs/phpspec/prophecy-phpunit/{lib_version}/loader.php';
require_once 'libs/sebastianbergmann/phpunit/12.2.2/loader.php';

use Prophecy\Prophet;
use PHPUnit\Framework\TestCase;

$obj = new Prophet();
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.