承接 conquest/relay 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

conquest/relay

最新稳定版本:v0.1.0

Composer 安装命令:

composer require conquest/relay

包简介

Share localized, backend-driven messages as text to your Inertia frontend.

README 文档

README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

This is where your description should go. Limit it to a paragraph or two. Consider adding a small example.

Installation

You can install the package via composer:

composer require conquest/relay

You can publish and run the migrations with:

You can publish the config file with:

php artisan vendor:publish --tag="relay-config"

This is the contents of the published config file:

return [
    'share' => true,
    'path' => base_path('lang'),
    'languages' => [
        'en' => 'English',
    ],
    'excludes' => [
        'validation.php',
    ],
];

Usage

Inside a controller, you can append translations to your application using the relay() helper.

relay();

By default, this will share all translations from the lang or the path set in the config directory to the frontend. You can customize this behavior by publishing the config file and modifying the excludes array. This array is cahced for each available language defined in the config('relay.languages') array. You can select to only pass a subset of translations to the frontend by adding keys using dot notations to reduce the amount of data sent over the wire. This accepts wildcard characters as well.

relay()->keys('messages.*', 'auth.login')

Ensure that the RelaysTranslations middleware is applied to any Inertia based routes. You can extend this middleware to overwrite the HandlesInertiaRequests middleware in the Laravel starter packages, as this package itself extends the Inertia middleware.

Testing

composer test

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

  • 总下载量: 7
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-07-06