Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Return current Unix timestamp
<?php time(): int
<?php public function testPrefix(): void
{
Route::prefix('planets')->group(function () {
Route::get('earth', fn() => time());
});
$this->assertEquals('/', Getter::getDelimiter());
<?php public function testDispatching(): void
{
$testy = function (): void {
print time();
};
Route::restart();
<?php public function testAppend(): void
{
Route::append('earth')->group(function () {
Route::get('planets', fn() => print time());
});
$routeData = Getter::create()->get(Route::getRoutes())[0];
<?php {
Route::restart();
Route::prepend('galaxies')->group(function () {
Route::get('milkyway', fn() => print time());
});
$routeData = Getter::create()->get(Route::getRoutes())[0];
<?php {
Route::restart();
Route::prefix('one')->group(function () {
Route::get('route', fn() => time());
});
Route::prefix('start')
<?php Route::prefix('start')
->append('end')
->group(function () {
Route::get('middle', fn() => time());
Route::prefix('inner')->group(function () {
Route::get('route', fn() => printer());
});
<?php Route::prefix('middle')
->prepend('start')
->group(function () {
Route::get('end', fn() => time());
});
Route::name('planets.')
<?php Route::name('planets.')
->group(function () {
Route::get('earth', fn() => time())->name('earth');
});
$routeData = $this->getRouteData();
<?php {
$theRoute = $this->createTheRoute();
$theRoute->get('user', fn() => print time());
$routeData = $theRoute->getData();
$this->assertEquals('GET', $routeData['method']);
$this->assertEquals('user', $routeData['prefix']);
<?php $this->assertEquals('user', $routeData['prefix']);
$theRoute->post('create', fn() => print time());
$routeData = $theRoute->getData();
$this->assertEquals('POST', $routeData['method']);
$this->assertEquals('create', $routeData['prefix']);
<?php $this->assertEquals('create', $routeData['prefix']);
$theRoute->delete('1', fn() => print time());
$routeData = $theRoute->getData();
$this->assertEquals('DELETE', $routeData['method']);
$this->assertEquals('1', $routeData['prefix']);
<?php $this->assertEquals('1', $routeData['prefix']);
$theRoute->put('2', fn() => print time());
$routeData = $theRoute->getData();
$this->assertEquals('PUT', $routeData['method']);
$this->assertEquals('2', $routeData['prefix']);
<?php $this->assertEquals('2', $routeData['prefix']);
$theRoute->patch('3', fn() => print time());
$routeData = $theRoute->getData();
$this->assertEquals('PATCH', $routeData['method']);
$this->assertEquals('3', $routeData['prefix']);
<?php $this->assertEquals('3', $routeData['prefix']);
$theRoute->head('test', fn() => print time());
$routeData = $theRoute->getData();
$this->assertEquals('HEAD', $routeData['method']);
$this->assertEquals('test', $routeData['prefix']);
<?php public function testMatch(): void
{
$fn = fn() => print time();
Route::restart();
Route::match(['GET', 'POST'], 'login', $fn)
->namespace('Auth');