lumen

How to specify Lumen (or Laravel) version on new installation?

余生颓废 提交于 2019-12-21 07:14:09
问题 I want to install a specific version of Laravel Lumen (5.1 instead of the lastest one 5.2) on a new project. From the documentation : lumen new blog or : composer create-project laravel/lumen --prefer-dist Does not work : it install the lastest one. 回答1: Create a project using the composer command : Create a Laravel 5.1 project into the blog folder : composer create-project laravel/laravel blog "5.1.*" Create a Lumen 5.1 project into the blog folder : composer create-project laravel/lumen

How to use multiple database in Lumen

依然范特西╮ 提交于 2019-12-21 02:46:21
问题 We've using Lumen for building API's , Now we need to access multiple databases. Currently using .env for database config but unable to found the way to multiple databases in .env where we need to read 2nd connection ... 回答1: First, you'll need to configure your connections. If you don't already have one you'll need to create a config directory in your project and add the file config/database.php . It might look like this: <?php return [ 'default' => 'accounts', 'connections' => [ 'mysql' =>

Why has the artisan serve command been removed from Lumen 5.2?

微笑、不失礼 提交于 2019-12-20 09:47:07
问题 Please. Does anybody know why Lumen's team removed the command php artisan serve ? That command's very helpful. 回答1: I don't speak for Taylor, but my guess is that his reasoning is that a given microframework should not know - or care - about the server that's running it. A microframework should just assume that it's going to work, and leave it to the developer to figure out which tools are best to make that happen. Laravel is different, in that it offers a more "complete" - and highly

Laravel Lumen Memcached not found

六月ゝ 毕业季﹏ 提交于 2019-12-20 08:56:32
问题 Ok, I just started with Lumen and I'm trying to use the Auth, but a call to either Auth::check or any other function of Auth.. leads to the below Error Fatal error: Class 'Memcached' not found in vendor\illuminate\cache\MemcachedConnector.php on line 52 . I don't want to use Memcached never used it before. I disabled it in the .env file and set the CACHE_DRIVER and SESSION_DRIVER to array, but still shows the same error. I decided not to use Auth again and to manually handle my authetication

Lumen Micro Framework => php artisan key:generate

北战南征 提交于 2019-12-20 08:05:08
问题 I'm trying out the PHP micro Framework Lumen (from Laravel). One of my first steps was to look into the .env.example file and make a copy of it to have my .env file. There is a variable APP_KEY just like there is in Laravel. Now I tried out the simple command php artisan key:generate to get my new key But I ran into the following error message: [InvalidArgumentException] There are no commands defined in the "key" namespace. Does some one know how I can generate keys for Lumen? Update with

Lumen not working out of the box

北城以北 提交于 2019-12-18 16:46:36
问题 Just installed Lumen framework. hit the link http://localhost/lumen/public/ in my browser and got this following error, anyone got any idea about it? Traced it back to the app.php file in bootstrap folder. 回答1: Open your terminal in the root folder run the following command php artisan serve . Lumen development server started on http://localhost:8000/ 回答2: if You want to access lumen project without "php artisan serve" $app->run(); replace with $request = Illuminate\Http\Request::capture();

Sessions in token based authentication

不打扰是莪最后的温柔 提交于 2019-12-18 12:16:06
问题 I am building an app in PHP Lumen which returns a token upon login. I am not sure how to proceed beyond this. How am I supposed to maintain a session using these tokens? Specifically, how do I store the tokens on the client side if I am using reactjs or vanilla HTML/CSS/jQuery and send them in every request I make for the secure part of my web app? 回答1: What I usually do is to keep the token in the local storage, this way I can persist the token even if the user leaves the site. localStorage

Redirect to public folder on Lumen (Laravel)

馋奶兔 提交于 2019-12-17 16:29:14
问题 I have a big problem. I work on an application in localhost with Lumen framework. My work environment is on Wamp (Windows). Lumen requires the root to be in the public folder. To do that, I have a configuration file like this : NameVirtualHost name.local <VirtualHost name.local> DocumentRoot C:/wamp/www/name/public ServerName name.local </VirtualHost> So, if I put the address name.local/ in my browser, I can reach to the index page. Now, I need to put all my work in a FTP. And there, I have

Laravel 5.2 php artisan routes not working

久未见 提交于 2019-12-14 03:45:56
问题 In Laravel 5.2, trying to display the routes list using php artisan routes . But, its not working. It will show the below errors, [Symfony\Component\Console\Exception\CommandNotFoundException] Command "routes" is not defined. How to fix this issue?? Thanks 回答1: It is php artisan route:list since Laravel 5.1 UPDATE It seems you're using Lumen, not Laravel. Unfortunately there are not many commands in Lumen, so if you really need to use them, you can create them or just use Laravel framework

Redirect to intended URL Lumen

隐身守侯 提交于 2019-12-13 18:21:23
问题 I'm building a little Lumen application with a simple API & Authentication. I want to redirect the user to the intended URL and if he visits /auth/login by himself I want him to redirect to /foo . In the Laravel Docs there is this function: return redirect()->intended('/foo'); When I use this in my route I get an error in the server log which says this: [30-Apr-2015 08:39:47 UTC] PHP Fatal error: Call to undefined method Laravel\Lumen\Http\Redirector::intended() in ~/Sites/lumen-test/app/Http