PHP code example of aw-studio / laravel-json-translations

1. Go to this page and download the library: Download aw-studio/laravel-json-translations library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

aw-studio / laravel-json-translations example snippets


// routes/web.php

use AwStudio\LaravelJsonTranslations\Facades\JsonTranslations;

// this will serve https://your-app.com/my-translations.js
JsonTranslations::javascript('my-translations', ['en', 'de']);

// will render to <script src="/my-translations.js"></script>
@translations('my-translations')

use AwStudio\LaravelJsonTranslations\Facades\JsonTranslations;

Route::get('json', function () {
    return JsonTranslations::json(['en', 'de']);
});