> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tolk.every-day.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Laravel package

> Push keys and fetch translations with tolk:push and tolk:pull.

<Warning>
  The `everyday-nl/tolk-laravel` package is being built in a separate repository and is not available yet. This page describes how it will work. Until it is available, use the API directly; see [Syncing keys](/developers/syncing-keys) and [Imports and exports](/developers/imports-and-exports).
</Warning>

The package makes Tolk part of the usual development flow: keys go to Tolk with `tolk:push`, and translations come back into the repository as files with `tolk:pull`.

## Installing

```bash theme={null}
composer require everyday-nl/tolk-laravel --dev
php artisan tolk:install
```

`tolk:install` publishes `config/tolk.php`. Then set in `.env`:

```bash .env theme={null}
TOLK_URL=https://api.tolk.every-day.io/v1
TOLK_TOKEN=tolk_…
```

Create the token under **Settings › API tokens** (*Instellingen › API-tokens*) of the project. For `tolk:push`, the token needs the permission **Read and write** (*Lezen en schrijven*); for `tolk:pull` only, **Read only** (*Alleen lezen*) is enough.

In `config/tolk.php` you set which paths the package reads (for example `lang/` and `lang/vendor/`) and which export profiles a pull fetches.

## Commands

| Command | What it does |
| - | - |
| `php artisan tolk:push` | Reads the source files and sends new and changed keys. With `--with-translations` also the existing translations, once, when connecting an existing project. Archives nothing, unless with `--archive-missing` |
| `php artisan tolk:pull` | Fetches the export profiles and writes them to disk. Writes atomically: first a temporary file, then a rename |
| `php artisan tolk:scan` | Searches the code for used keys and reports missing and possibly unused keys |
| `php artisan tolk:status` | Shows the progress per language |

```bash theme={null}
# sync
php artisan tolk:push && php artisan tolk:pull
```

## Smart syncing

* **Push as a delta.** The package computes a hash per key locally and first sends only that list. Only new and changed keys are sent after that.
* **Pull with an ETag.** The package sends the last ETag. If nothing has changed, Tolk responds with `304 Not Modified` and the package writes nothing.
* **Final check.** Before writing, the package checks the placeholders in the received files once more.

## Working with git

After a pull, translations are simply in the repository. Commit them like any other code. A deploy therefore does not need Tolk. Use the [GitHub Action](/developers/github-action) to automate this.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.