nobox/lazy-strings-lumen
Composer 安装命令:
composer require nobox/lazy-strings-lumen
包简介
Lumen service provider for LazyStrings.
README 文档
README
Lumen service provider for LazyStrings.
Installation
Add Lazy Strings to your composer.json file.
composer require nobox/lazy-strings-lumen
Lumen versions
Here's a rundown on the version(s) of lazy strings that you can use on your current installed lumen version.
| Lumen version | Service Provider version to use |
|---|---|
| 5.0 | 1.0.* |
| 5.1 | 1.1.* |
| 5.2 | 1.2.* |
Register Lazy Strings configuration and service provider
You must enable facades. Uncomment the line $app->withFacades(); on bootstrap/app.php.
Register Lazy Strings configuration. Add this line on bootstrap/app.php. It can go anywhere, I would recommend to add it after $app->withEloquent();.
$app->configure('lazy-strings');
Finally, register Lazy Strings service provider, also in bootstrap/app.php.
$app->register(Nobox\LazyStrings\LazyStringsServiceProvider::class);
Publish configuration and assets
This package uses some basic configuration and pretty CSS and JS from bootstrap.
php artisan lazy:publish
Configuration
Configuration is pretty simple, each configuration item is described below. More details on how these work can be found in the Lazy Strings repo here.
csv-urlAdd the Google spreadsheet published url.
'csv-url' => 'http://docs.google.com/spreadsheets/d/1V_cHt5Fe4x9XwVepvlXB39sqKXD3xs_QbM-NppkrE4A/export?format=csv'
target-folderThis folder will be in yourstoragefolder and it just saves a backup of your strings inJSONformat. By default islazy-strings.
'target-folder' => 'lazy-strings'
strings-routeThis is the route that will be used to generate the strings. Visithttp://my-app.com/lazy/build-copyand your strings will be updated. By default isbuild-copy. The route will always be under thelazyprefix.
'strings-route' => 'build-copy'
nestedWhether or not you wish your generated strings array to be nested.
'nested' => true,
sheetsHere you'll specify all the sheets in your Google doc.
'sheets' => [ 'en' => [0, 1626663029], 'es' => 1329731586, 'pt' => 1443604037 ]
How it works
Lazy Strings uses an id => value convention to access the copy, it generates an lazy.php file inside the language locale folder. You can see an example doc here: https://docs.google.com/a/nobox.com/spreadsheets/d/1V_cHt5Fe4x9XwVepvlXB39sqKXD3xs_QbM-NppkrE4A/edit#gid=0.
| id | value |
|---|---|
| foo | Hello! |
| lazy | LazyStrings |
| laravel | PHP Framework |
In this doc you can access the first row in your view like this:
trans('lazy.foo') // returns "Hello!"
Or in your controller like this:
Lang::get('lazy.foo'); // returns "Hello!"
Generate your strings
Each time you need to generate your strings just visit the specified strings-route in your configuration. The route will always be under the lazy prefix. For example: http://my-app.com/lazy/build-copy.
You can also use the included artisan command php artisan lazy:deploy. It will do exactly the same. This is perfect when you're deploying your application with Forge or Envoyer.
License
MIT
nobox/lazy-strings-lumen 适用场景与选型建议
nobox/lazy-strings-lumen 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 13 次下载、GitHub Stars 达 0, 最近一次更新时间为 2016 年 01 月 08 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「spreadsheet」 「googledocs」 「lumen」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 nobox/lazy-strings-lumen 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 nobox/lazy-strings-lumen 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 nobox/lazy-strings-lumen 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
This Symfony bundle integrates PhpSpreadsheet into Symfony using Twig.
Testing Suite For Lumen like Laravel does.
PHPExcel - OpenXML - Read, Create and Write Spreadsheet documents in PHP - Spreadsheet engine
PHPExcel - OpenXML - Read, Create and Write Spreadsheet documents in PHP - Spreadsheet engine
Stackdriver handler for Monolog (codeinternetapplications/monolog-stackdriver Fork).
Class to generate a standard structure for api json responses
统计信息
- 总下载量: 13
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 10
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-01-08