PHPackages                             phpactor/completion - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. phpactor/completion

AbandonedArchivedLibrary[Utility &amp; Helpers](/categories/utility)

phpactor/completion
===================

Completion library for Worse Reflection

0.4.7(4y ago)554.3k↑100%7[4 PRs](https://github.com/phpactor/completion/pulls)4MITPHPPHP ^7.3 || ^8.0

Since Apr 22Pushed 4y ago3 watchersCompare

[ Source](https://github.com/phpactor/completion)[ Packagist](https://packagist.org/packages/phpactor/completion)[ RSS](/packages/phpactor-completion/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (15)Versions (24)Used By (4)

Phpactor Completion
===================

[](#phpactor-completion)

[![CI](https://github.com/phpactor/completion/workflows/CI/badge.svg)](https://github.com/phpactor/completion/workflows/CI/badge.svg)

PHP Code Completion library for [Phpactor](https://github.com/phpactor/phpactor).

This package includes:

- Completion APIs and implementations.
- Phpactor RPC extension and handlers.
- Language Server extension and handlers.

Usage
-----

[](#usage)

Each completor implements the `Completor` interface which accepts the source code as a string and a byte offset from which to complete from. The completor must `yield` instances of the `Suggestion` class:

```
$completor = new MyCompletor();
$suggestions = $completor->complete($sourceCode, $byteOffset);

/** @var Suggestion $suggestion */
foreach ($suggestions as $suggestion) {
    echo $suggestion->name();
    echo $suggestion->shortDescription();
}
```

Multiple completors can be chained together with the ChainCompletor:

```
$completor = new ChainCompletor([
    new MyCompletor1(),
    new MyCompletor2(),
]);

$suggestions = $completor->complete($sourceCode, $byteOffset);
```

Tolerant Completors
-------------------

[](#tolerant-completors)

The library currently includes a suite of completors using the Tolerant PHP Parser and [WorseReflection](https://github.com/phpactor/worse-reflection). All of the tolerant completors are instances of `TolerantCompletorInterface`and accept a parser node rather than a byte offset. They can be collected in a `TolerantChainCompletor` class which in turn implements the primary `Completor` interface:

```
use Phpactor\WorseReflection\ReflectorBuilder;
use Phpactor\Completion\Bridge\TolerantParser\ChainTolerantCompletor;
use Phpactor\Completion\Bridge\TolerantParser\WorseReflection\WorseLocalVariableCompletor;
use Phpactor\Completion\Bridge\TolerantParser\WorseReflection\WorseClassMemberCompletor;

$reflector = ReflectorBuilder::create()->addSource($sourceCode)->build();
$formatter = new ObjectFormatter([
    // ... instances of ObjectFormatter
]);
$completor = new ChainTolerantCompletor([
    new WorseLocalVariableCompletor($reflector, $formatter),
    new WorseClassMemberCompletor($reflector, $formatter),
]);

$completor->complete($sourceCode, $byteOffset);
```

Formatters
----------

[](#formatters)

This library can format arbitrary objects as strings, for example to go from a `ReflectionMethod` to the synopsis: `pub function($foobar)`.

```
$formatter = new ObjectFormatter([
    new TypeFormatter(),
    new TypesFormatter(),
    new FunctionFormatter(),
    new MethodFormatter(),
    new ParameterFormatter(),
    new ParametersFormatter(),
    new PropertyFormatter(),
    new VariableFormatter(),
]);

$reflectionMethod = $reflector->reflectClass(Foobar::class)->methods()->get('barfoo');
$formatter->format($reflectionMethod);
```

Each formatter is able to indicate if it can format a given object, and if so it is chosen.

Contributing
------------

[](#contributing)

This package is open source and welcomes contributions! Feel free to open a pull request on this repository.

Support
-------

[](#support)

- Create an issue on the main [Phpactor](https://github.com/phpactor/phpactor) repository.
- Join the `#phpactor` channel on the Slack [Symfony Devs](https://symfony.com/slack-invite) channel.

###  Health Score

40

—

FairBetter than 88% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity35

Limited adoption so far

Community24

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 87.1% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~96 days

Total

13

Last Release

1549d ago

PHP version history (3 changes)0.2.0PHP ^7.1

0.4.0PHP ^7.3

0.4.3PHP ^7.3 || ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/24ec7d5d6b7ea54007be5d7b4f43800381cc1e22929f7d2276fba30e497fdfa6?d=identicon)[dantleech](/maintainers/dantleech)

---

Top Contributors

[![dantleech](https://avatars.githubusercontent.com/u/530801?v=4)](https://github.com/dantleech "dantleech (339 commits)")[![camilledejoye](https://avatars.githubusercontent.com/u/11501572?v=4)](https://github.com/camilledejoye "camilledejoye (30 commits)")[![kermorgant](https://avatars.githubusercontent.com/u/10561580?v=4)](https://github.com/kermorgant "kermorgant (9 commits)")[![weeman1337](https://avatars.githubusercontent.com/u/6216686?v=4)](https://github.com/weeman1337 "weeman1337 (5 commits)")[![BladeMF](https://avatars.githubusercontent.com/u/12109622?v=4)](https://github.com/BladeMF "BladeMF (4 commits)")[![Taluu](https://avatars.githubusercontent.com/u/239685?v=4)](https://github.com/Taluu "Taluu (1 commits)")[![weirdan](https://avatars.githubusercontent.com/u/57403?v=4)](https://github.com/weirdan "weirdan (1 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/phpactor-completion/health.svg)

```
[![Health](https://phpackages.com/badges/phpactor-completion/health.svg)](https://phpackages.com/packages/phpactor-completion)
```

###  Alternatives

[phpactor/phpactor

PHP refactoring and intellisense tool for text editors

1.8k15.7k](/packages/phpactor-phpactor)[dantleech/fink

Checks Links

2266.3k2](/packages/dantleech-fink)[schmeits/filament-pan-analytics-widget

A widget for pan (lightweight and privacy-focused PHP product analytics library)

221.9k](/packages/schmeits-filament-pan-analytics-widget)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
