PHP 8 · Web, security and database

Use namespaces and autoloading

Declare a namespace, then load classes through Composer's autoloader.

namespace App\Services;

use App\Models\User;

require __DIR__ . '/vendor/autoload.php';

Official PHP 8 documentation

More web, security and database commands

All web, security and database commands · PHP 8 cheatsheet

Was this page helpful?