Syntax
use App\Services\Mailer;
$mailer = new Mailer();Examples
PHP use imports example
A focused example you can adapt while practising.
use App\Services\Mailer;
$mailer = new Mailer();Best practices
- Start with the smallest working example, then adapt it to your project.
- Use the language’s standard library and idioms before introducing extra dependencies.
At a glance
- Purpose
- Server-side web applications
- File extension
- .php
- Runs in
- PHP runtime on a server or CLI
- Usually used with
- HTML, databases and web servers
Specifications & further reading
Related PHP documentation
PHP Classes & Interfaces
Classes define objects, while interfaces define methods an implementing class must provide. Visibility controls whether members are public, protected, or private.PHP namespaces
PHP reference for php namespaces.PHP class definitions
PHP reference for php class definitions.PHP member visibility
PHP reference for php member visibility.
Classes define objects, while interfaces define methods an implementing class must provide. Visibility controls whether members are public, protected, or private.PHP namespaces
PHP reference for php namespaces.PHP class definitions
PHP reference for php class definitions.PHP member visibility
PHP reference for php member visibility.