> For the complete documentation index, see [llms.txt](https://akyos.gitbook.io/book/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://akyos.gitbook.io/book/wordpress/guides/creer-un-livewire.md).

# Créer un Livewire

{% hint style="warning" %}
Assurez-vous d'avoir lancé la commande `wp acorn key:generate` sinon Livewire ne marchera pas du tout.
{% endhint %}

{% hint style="info" %}
Documentation : <https://livewire.laravel.com/docs/quickstart>
{% endhint %}

{% stepper %}
{% step %}

### Utiliser la commande d'Acorn

Acorn fournit un stub d'un composant Livewire (class + view) en éxecutant la commande suivante :&#x20;

```
wp acorn make:livewire PostList
```

{% endstep %}

{% step %}

### Créer la logique&#x20;

Ajouter vos fonctions et retournez des variables à la vue comme un bloc classique&#x20;
{% endstep %}

{% step %}

### Créer la vue

La vue du composant se trouve dans :\
`resources/views/livewire/post-list.blade.php`
{% endstep %}

{% step %}

### Intégrer le composant

Pour appeler un livewire, voilà la syntaxe :&#x20;

```
<livewire:post-list/>
```

{% endstep %}
{% endstepper %}
