PHP Classes

File: src/Route/not-found.routes.php

Recommend this page to a friend!
  Classes of Pierre-Henry Soria   PHP RESTful API Example   src/Route/not-found.routes.php   Download  
File: src/Route/not-found.routes.php
Role: Auxiliary script
Content type: text/plain
Description: Auxiliary script
Class: PHP RESTful API Example
Example implementation of a REST API
Author: By
Last change:
Date: 7 months ago
Size: 430 bytes
 

Contents

Class file image Download
<?php
/**
 * @author Pierre-Henry Soria <hi@ph7.me>
 * @website https://ph7.me
 * @license MIT License
 */

namespace PH7\ApiSimpleMenu\Route;

use
PH7\JustHttp\StatusCode;
use
PH7\PhpHttpResponseHeader\Http;

// PHP 7.4 anonymous arrow function
$getResponse = fn(): string => json_encode(['error' => 'Request not found']);

// Send HTTP 404 Not Found
Http::setHeadersByCode(StatusCode::NOT_FOUND);
echo
$getResponse();