lumen

Lumen 使用事件需要注意的事项

牧云@^-^@ 提交于 2019-11-29 12:49:24
Lumen 版本 5.2 参考手册 laravel event 需要注意的事项 如果是第一次在lumen下使用事件,需要修改bootstrap\app.php文件 添加对EventServiceProvider的注册 (一般是被注释掉了,取消注释即可) $app->register(App\Providers\EventServiceProvider::class); 在编写Listener的时候,注意use 需要监听的Event类 使用异步事件的时候,需要使用队列,请先配置好队列,需要启动监听,命令如下: php artisan queue:listen --queue:default 来源: http://www.cnblogs.com/cshua/p/7084353.html

lumen时区

点点圈 提交于 2019-11-29 12:48:55
今天用 Lumen 框架写代码时, 也是初次体验 Lumen, 遇到了一个问题, 从数据库里查出的时间比数据库里保存的 TIMESTAMP 时间慢了8个小时, 很明显这是一个时区设置的问题, 本以为可以在1分钟内解决的, 但是我错了。 根据 Laravel 4.x 和 5.0 的经验, 只需要到 config/app.php 中设置下 'timezone' 参数为 'PRC' 就好了, 找到 Lumen 的 config 目录, 在 /vendor/laravel/lumen-framework/config 路径下, 但是 config/app.php 的参数选项中没有 timezone 参数选项, 手动加上后也是无效的。 然后想到 Laravel 5 的 .env 文件, 结果发现 Lumen 的 .env 文件里也没有关于 timezone 设置的选项。 又回到 config 目录, 看看 config/database.php 中的设置, 关于 mysql 的默认配置如下: 'mysql' => [ 'driver' => 'mysql', 'host' => env( 'DB_HOST', 'localhost'), 'port' => env( 'DB_PORT', 3306), 'database' => env( 'DB_DATABASE', 'forge'),

Lumen fails to change locale

纵然是瞬间 提交于 2019-11-29 10:55:56
I have an almost fresh installation of Lumen. I have a POST route which leads to one Controller. In the request I send lang parameter with a string value. public function form(Request $request) { if ($request->has('lang')) { app('config')->set('app.locale', $request->input('lang')); } return view('form'); } I have one folder more in my /resources/lang/ folder called bg . In this folder I have simple file which has an array just like in resources/lang/en/validation.php - called static.php . In the view I'm displaying I have few lines that say: <input type="text" name="email" value="" class=

How to do {{ asset('/css/app.css') }} in Lumen?

99封情书 提交于 2019-11-29 10:09:41
In Lumen, I can do this in my blade template: {{ url('/css/app.css') }} In Laravel I could do {{ asset('/css/app.css') }} Is the url helper all I have to work with in Lumen? Have look at Lumen UrlGenerator source code , the Lumen framework supports just url and route helpers. Of course, you can write the asset helper if you want. Had the same problem, moving from laravel to lumen. As @hieu-le says, I made an asset helper as below. if (!function_exists('urlGenerator')) { /** * @return \Laravel\Lumen\Routing\UrlGenerator */ function urlGenerator() { return new \Laravel\Lumen\Routing\UrlGenerator

Unable to use Laravel / Socialite with Lumen

守給你的承諾、 提交于 2019-11-29 08:42:16
I try to use the package Laravel\Socialite in my system in Lumen (5.1) I added this in the config\services.php file : <?php //Socialite 'facebook' => [ 'client_id' => '##################', 'client_secret' => '##################', 'redirect' => 'http://local.dev/admin/facebook/callback', ], In bootstrap\app.php file : class_alias(Laravel\Socialite\Facades\Socialite::class, 'Socialite'); $app->register(Laravel\Socialite\SocialiteServiceProvider::class); Then I created a controller for the facebook authentication : <?php namespace App\Http\Controllers\Facebook; use App\Http\Controllers\Controller

Lumen and MongoDB?

无人久伴 提交于 2019-11-28 20:36:59
问题 Is it somehow possible to include the mongodb connection settings into a lumen framework. As from what I saw the config/database.php is loaded internally in the lumen package. Is there a way to extend it somehow to include the mongodb connection settings? 回答1: We're actually using Lumen, Laravel, Mongo, and MySQL in one giant project so I can help you through this one. Assuming you want to use MongoDB with eloquent instead of with the raw MongoClient. You can find the library I'm using from

Lumen fails to change locale

南笙酒味 提交于 2019-11-28 03:42:08
问题 I have an almost fresh installation of Lumen. I have a POST route which leads to one Controller. In the request I send lang parameter with a string value. public function form(Request $request) { if ($request->has('lang')) { app('config')->set('app.locale', $request->input('lang')); } return view('form'); } I have one folder more in my /resources/lang/ folder called bg . In this folder I have simple file which has an array just like in resources/lang/en/validation.php - called static.php . In

How to do {{ asset('/css/app.css') }} in Lumen?

有些话、适合烂在心里 提交于 2019-11-28 03:26:13
问题 In Lumen, I can do this in my blade template: {{ url('/css/app.css') }} In Laravel I could do {{ asset('/css/app.css') }} Is the url helper all I have to work with in Lumen? 回答1: Have look at Lumen UrlGenerator source code, the Lumen framework supports just url and route helpers. Of course, you can write the asset helper if you want. 回答2: Had the same problem, moving from laravel to lumen. As @hieu-le says, I made an asset helper as below. if (!function_exists('urlGenerator')) { /** * @return

Differences and Similarities Between Lumen and Laravel

空扰寡人 提交于 2019-11-28 02:54:18
I read the documentation and it seems Lumen is Laravel with less features. I must be missing something. I am looking for a comparison table of the components and features of both Laravel and Lumen. Does anyone know the differences? lukasgeiter Update (5.2) With the latest version of Lumen (5.2) the Microframework focuses on Stateless APIs. The documentation states: Lumen 5.2 represents a shift on slimming Lumen to focus solely on serving stateless, JSON APIs. As such, sessions and views are no longer included with the framework. If you need access to these features, you should use the full

Lumen 5.3 send email

此生再无相见时 提交于 2019-11-27 18:47:52
问题 I tried send a email from Lumen using gmail smtp config. I am using: illuminate/mail , Version 5.3 lumen , Version 5.3 I can't send an email. My router: $app->get('/', function () use ($app) { $app->get('mail','mailcontroller@mail'); }); My AppServiceProvider.php : namespace App\Providers; use Illuminate\Support\ServiceProvider; class AppServiceProvider extends ServiceProvider { public function register() { $this->app->singleton('mailer', function ($app) { $app->configure('services'); return