1. Go to this page and download the library: Download ramsey/composer-repl-lib library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
ramsey / composer-repl-lib example snippets
> $hello = 'Hello, world'
= "Hello, world"
> echo $hello
Hello, world
> foreach ([1, 2, 3] as $x) echo $x . "\n"
1
2
3
> $date = new DateTimeImmutable();
= DateTimeImmutable @1772598406 {#359
date: 2026-03-04 04:26:46.679771 UTC (+00:00),
}
> $getDate = fn (DateTimeInterface $dt): DateTimeInterface => $dt;
= Closure(DateTimeInterface $dt): DateTimeInterface {#381 …3}
> t assertInstanceOf(DateTimeInterface::class, $date);
Test passed!
> t assertSame($date, $getDate($date))
Test passed!
> phpunit
PHPUnit 13.0.5 by Sebastian Bergmann and contributors.
Runtime: PHP 8.5.3
Configuration: /path/to/ramsey/composer-repl-lib/phpunit.xml.dist
..................................SS.... 40 / 40 (100%)
Time: 00:00.288, Memory: 48.00 MB
OK, but some tests were skipped!
Tests: 40, Assertions: 105, Skipped: 2.
$foo = 'bar';
> ls
Variables: $env, $foo, $phpunit
> $foo
= "bar"