PHP Libraries › phpspec › prophecy PHP library for creating mock objects in tests efficiently and effectively.
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.
Classes: Prophecy\Argument Prophecy\Doubler\CachedDoubler Prophecy\Doubler\ClassPatch\SplFileInfoPatch Prophecy\Doubler\ClassPatch\ReflectionClassNewInstancePatch Prophecy\Doubler\ClassPatch\KeywordPatch Prophecy\Doubler\ClassPatch\TraversablePatch Prophecy\Doubler\ClassPatch\ThrowablePatch Prophecy\Doubler\ClassPatch\ProphecySubjectPatch Prophecy\Doubler\ClassPatch\MagicCallPatch Prophecy\Doubler\ClassPatch\ClassPatchInterface Prophecy\Doubler\ClassPatch\DisableConstructorPatch Prophecy\Doubler\LazyDouble Prophecy\Doubler\NameGenerator Prophecy\Doubler\DoubleInterface Prophecy\Doubler\Generator\TypeHintReference Prophecy\Doubler\Generator\ClassMirror Prophecy\Doubler\Generator\ClassCreator Prophecy\Doubler\Generator\ReflectionInterface Prophecy\Doubler\Generator\ClassCodeGenerator Prophecy\Doubler\Generator\Node\TypeNodeAbstract Prophecy\Doubler\Generator\Node\MethodNode Prophecy\Doubler\Generator\Node\ReturnTypeNode Prophecy\Doubler\Generator\Node\ArgumentNode Prophecy\Doubler\Generator\Node\ArgumentTypeNode Prophecy\Doubler\Generator\Node\ClassNode Prophecy\Doubler\Doubler Prophecy\Prophecy\Revealer Prophecy\Prophecy\ProphecyInterface Prophecy\Prophecy\ObjectProphecy Prophecy\Prophecy\MethodProphecy Prophecy\Prophecy\ProphecySubjectInterface Prophecy\Prophecy\RevealerInterface Prophecy\Prediction\PredictionInterface Prophecy\Prediction\CallTimesPrediction Prophecy\Prediction\CallPrediction Prophecy\Prediction\CallbackPrediction Prophecy\Prediction\NoCallsPrediction Prophecy\PhpDocumentor\ClassTagRetriever Prophecy\PhpDocumentor\ClassAndInterfaceTagRetriever Prophecy\PhpDocumentor\MethodTagRetrieverInterface Prophecy\Promise\ReturnArgumentPromise Prophecy\Promise\CallbackPromise Prophecy\Promise\PromiseInterface Prophecy\Promise\ThrowPromise Prophecy\Promise\ReturnPromise Prophecy\Call\CallCenter Prophecy\Call\Call Prophecy\Comparator\FactoryProvider Prophecy\Comparator\ProphecyComparator Prophecy\Comparator\ClosureComparator Prophecy\Comparator\Factory Prophecy\Exception\Doubler\ReturnByReferenceException Prophecy\Exception\Doubler\ClassCreatorException Prophecy\Exception\Doubler\ClassNotFoundException Prophecy\Exception\Doubler\DoublerException Prophecy\Exception\Doubler\DoubleException Prophecy\Exception\Doubler\MethodNotExtendableException Prophecy\Exception\Doubler\ClassMirrorException Prophecy\Exception\Doubler\MethodNotFoundException Prophecy\Exception\Doubler\InterfaceNotFoundException Prophecy\Exception\Prophecy\ProphecyException Prophecy\Exception\Prophecy\ObjectProphecyException Prophecy\Exception\Prophecy\MethodProphecyException Prophecy\Exception\Prediction\AggregateException Prophecy\Exception\Prediction\UnexpectedCallsException Prophecy\Exception\Prediction\NoCallsException Prophecy\Exception\Prediction\PredictionException Prophecy\Exception\Prediction\UnexpectedCallsCountException Prophecy\Exception\Prediction\FailedPredictionException Prophecy\Exception\Call\UnexpectedCallException Prophecy\Exception\Exception Prophecy\Exception\InvalidArgumentException Prophecy\Argument\Token\ArrayCountToken Prophecy\Argument\Token\AnyValuesToken Prophecy\Argument\Token\LogicalAndToken Prophecy\Argument\Token\ArrayEveryEntryToken Prophecy\Argument\Token\ObjectStateToken Prophecy\Argument\Token\InArrayToken Prophecy\Argument\Token\TypeToken Prophecy\Argument\Token\ArrayEntryToken Prophecy\Argument\Token\StringContainsToken Prophecy\Argument\Token\TokenInterface Prophecy\Argument\Token\IdenticalValueToken Prophecy\Argument\Token\CallbackToken Prophecy\Argument\Token\LogicalNotToken Prophecy\Argument\Token\ExactValueToken Prophecy\Argument\Token\AnyValueToken Prophecy\Argument\Token\ApproximateValueToken Prophecy\Argument\Token\NotInArrayToken Prophecy\Argument\ArgumentsWildcard Prophecy\Util\ExportUtil Prophecy\Util\StringUtil Prophecy\Prophet Close Download Latest Version: 1.22.0 Coming soonPrevious 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);
?>
Report a broken download or code 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.