Autocompletion

Autocompletion is an IDE or editor feature that suggests or completes code while the developer is typing. It speeds up development, reduces typos, and surfaces available APIs without requiring constant documentation lookups.

PHP autocompletion relies on static analysis: type declarations in the source, PHPDoc annotations, and type inference where a type is not explicitly specified by may be guessed with a high level of confidence. Autocompletion relies on a LSP server: Language Server Protocol.

Autocompletion also applies to IDE plugins, framework-specific stubs, and tools like stub files to enable completion for external components.

<?php

    // Full type information enables accurate autocompletion
    function getUser(int $id): User {
        return new User($id);
    }

    $user = getUser(1);
    $user->  // IDE suggests: getName(), getEmail(), getId() …

?>

Documentation

See also Intelephense – PHP language server, Laravel IDE Helper and PHP Language Server Protocol.

Related : Type System, Type System, Type Inference, PHPdoc, Static Code Analysis (SCA), LSP, LSP, PHP AI Editor, PHP Editor, Integrated Environment of Development (IDE)

Related packages : barryvdh/laravel-ide-helper