Skip to main content
Stringhive Installation & Setup

Laravel SDK: Installation & Setup

The Stringhive Laravel SDK gives you Artisan commands and a PHP facade for pushing and pulling translations. No manual HTTP calls, no custom scripts.

Requirements

  • PHP 8.5 or higher
  • Laravel 13 or higher

Install

composer require stringhive/laravel

That's it. The service provider registers automatically via Laravel's package discovery.

Configure

Add your API token and default Hive to your .env file:

STRINGHIVE_TOKEN=shv_yourtokenhere
STRINGHIVE_HIVE=my-app
STRINGHIVE_LANG_PATH=resources/lang/my-app
Variable Required Description
STRINGHIVE_TOKEN Yes Your API token from Settings > API Tokens
STRINGHIVE_HIVE No Default Hive slug — used when you don't pass a hive argument
STRINGHIVE_LANG_PATH No Custom lang directory (defaults to lang_path())
STRINGHIVE_URL No Only set if you're running a self-hosted server

Create a token with the Write ability for pushing, Read for pulling. For CI/CD, give it both.

Publish the config (optional)

If you want to version-control the defaults:

php artisan vendor:publish --tag=stringhive-config

This drops a config/stringhive.php you can edit. Environment variables always take priority.

Excluding files

To permanently skip certain files on every push and pull, add glob patterns to your config:

'exclude' => [
    'auth.php',
    'passwords.php',
],

Including files

To only ever sync a specific subset of files, use include. When this list is non-empty, only matching files are processed — everything else is ignored:

'include' => [
    'app.php',
    'validation.php',
],

include and exclude work together: a file must match an include pattern (if any) and not match any exclude pattern. Both lists can also be overridden per-command with --include and --exclude flags.

Verify the connection

php artisan stringhive:push --dry-run

If you see a summary of what would be pushed, you're connected. If you get an authentication error, double-check your token.