An open API service indexing awesome lists of open source software.

https://github.com/putyourlightson/craft-autocomplete

Provides autocompletion for Craft CMS and plugins in Twig templates.
https://github.com/putyourlightson/craft-autocomplete

Last synced: 10 months ago
JSON representation

Provides autocompletion for Craft CMS and plugins in Twig templates.

Awesome Lists containing this project

README

          

[![Stable Version](https://img.shields.io/packagist/v/putyourlightson/craft-autocomplete?label=stable)]((https://packagist.org/packages/putyourlightson/craft-autocomplete))
[![Total Downloads](https://img.shields.io/packagist/dt/putyourlightson/craft-autocomplete)](https://packagist.org/packages/putyourlightson/craft-autocomplete)

# Autocomplete for Craft CMS [DEPRECATED]

### ⚠️ This package has been replaced by the superior [Craft Autocomplete](https://github.com/nystudio107/craft-autocomplete) as a collaboration between [PutYourLightsOn](https://putyourlightson.com/) and [nystudio107](https://nystudio107.com/).

Provides autocompletion for Craft CMS and plugins in Twig templates.

Currently works with **PhpStorm only**, as VSCode does not support intellisense for Twig extensions.

Adapted from `FauxTwigExtension.php` by nystudio107 as documented in the article:
https://nystudio107.com/blog/auto-complete-craft-cms-3-apis-in-twig-with-phpstorm

![demo](https://user-images.githubusercontent.com/57572400/126911028-7d7d06dd-c60f-42b9-ae42-95d5f078a229.gif)

## Usage

Install the package using composer.

```
composer require putyourlightson/craft-autocomplete
```

Ensure that the Symfony plugin is installed and enabled in PhpStorm:
https://plugins.jetbrains.com/plugin/7219-symfony-plugin

Once your IDE indexes the files, autocompletion for Craft and supported plugins will immediately become available in your Twig templates.

![screenshot](https://user-images.githubusercontent.com/57572400/125784167-618830ae-e475-4faf-81d3-194ad7ce3a08.png)

### Adding Custom Variables

You can add autocompletion for your own custom modules/plugins by creating a file called `AutocompleteVariable.php` and placing it inside any folder that PhpStorm will index (for example in the `/config` directory).

```php