lumen

Deepin nginx lumen配置

本小妞迷上赌 提交于 2019-12-01 07:05:50
正常安装 sudo apt install nginxsudo apt install php-fpm 启动后将 /etc/nginx/sites-enabled/default 配置文件 copy一份到 /etc/nginx/conf.d/lumen_demo.conf 然后按照该配置文件改改,修改后的配置文件如下: server { listen 80; listen [::]:80;​ root ~/workspace/php/lumen/public;​ server_name lumen_demo.com; error_log /var/log/nginx/lumne_demo_error.log;​ location / { try_files $uri $uri/ /index.php?$query_string; } location ~ \.php$ { include snippets/fastcgi-php.conf; fastcgi_pass unix:/run/php/php7.0-fpm.sock; }} 完成,满心欢喜的访问 抱歉,404,下面是踩坑环节 踩坑开始 访问不到文件 在public文件夹下新建一个 test.html 文件,访问 lumen_test.com/test.html , 仍然404 是我哪里配错了?回到 defalt配置文件

Lumen微服务生成Swagger文档

拟墨画扇 提交于 2019-12-01 06:33:27
[TOC] 作为一名phper,在使用Lumen框架开发微服务的时候,API文档的书写总是少不了的,比较流行的方式是使用swagger来写API文档,但是与Java语言原生支持 annotation 不同,php只能单独维护一份swagger文档,或者在注释中添加annotations来实现类似的功能,但是注释中书写Swagger注解是非常痛苦的,没有代码提示,没有格式化。 本文将会告诉你如何借助phpstorm中annotations插件,在开发Lumen微服务项目时(Laravel项目和其它php项目方法类似)快速的在代码中使用注释来创建swagger文档。 本文将会持续修正和更新,最新内容请参考我的 GITHUB 上的 程序猿成长计划 项目,欢迎 Star,更多精彩内容请 follow me 。 框架配置 我们使用当前最新的 Lumen 5.7 来演示。演示代码放到了github,感兴趣的可以参考一下 https://github.com/mylxsw/lumen-swagger-demo 安装依赖 在Lumen项目中,首先需要使用 composer 安装SwaggerLume项目依赖 composer require darkaonline/swagger-lume 项目配置 在 bootstrap/app.php 文件中,去掉下面配置的注释(大约在26行)

Laravel - Send api_token within the header

眉间皱痕 提交于 2019-12-01 00:52:07
I'm building an API for Laravel and I want to send the api_token within the header instead of the form post. Is this something that is already built in or would I have to go the route of figuring out how to create my own auth driver? After struggling a little with this myself I got it working. You need to first follow this little tutorial on how to use the api_token for your laravel API: https://gistlog.co/JacobBennett/090369fbab0b31130b51 Then once you have the api_token in the users table etc you can now pass this in the header of each request. My laravel is using the Vueify templates, ie I

Lumen框架 让产生的日志文件按照天存储

折月煮酒 提交于 2019-11-30 18:17:53
找到bootstrap/app.php,在return app;之前添加如下代码: 1 $app->configureMonologUsing(function(Monolog\Logger $monolog) use ($app) { 2 return $monolog->pushHandler( 3 new \Monolog\Handler\RotatingFileHandler($app->storagePath().'/logs/lumen.log') 4 ); 5 }); 之后在storage/logs/下面就可以看到lumen-2019-10.08.log这样的日志文件啦。 来源: https://www.cnblogs.com/bchf/p/11634640.html

Lumen not working out of the box

守給你的承諾、 提交于 2019-11-30 13:53:23
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. Open your terminal in the root folder run the following command php artisan serve . Lumen development server started on http://localhost:8000/ if You want to access lumen project without "php artisan serve" $app->run(); replace with $request = Illuminate\Http\Request::capture(); $app->run($request); from this path yourlumenproject/public/index.php if you want to serve your app in local

lumen framework routing not working

萝らか妹 提交于 2019-11-30 12:32:17
I use the Lumen framework for first time, the route / to my HomeController is not working. This is my route.php: $app->get('/', 'HomeController@index'); But I get the following error: [2015-04-17 07:03:41] lumen.ERROR: exception 'ReflectionException' with message 'Class HomeController does not exist' in /Users/refear99/Web/qingsongchou_api/vendor/illuminate/container/Container.php:776 Stack trace: #0 /Users/refear99/Web/qingsongchou_api/vendor/illuminate/container/Container.php(776): ReflectionClass->__construct('HomeController') #1 /Users/refear99/Web/qingsongchou_api/vendor/illuminate

Sessions in token based authentication

倾然丶 夕夏残阳落幕 提交于 2019-11-30 08:09:49
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? 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.setItem('app-token', theTokenFromServer); Every time the user loads the page, the first thing I do is to

Enabling session in lumen framework

有些话、适合烂在心里 提交于 2019-11-30 07:16:38
I have two (but let's image more) micro-services (API) which need to be aware of authenticated user. Ideally I would simple like to resume their sessions. All micro-services are using same storage for sessions: redis. All API calls will have Cookie header, so all services will be able to resume sessions based on that cookie. I have successfully implemented this via PHP $_SESSIONs. Now the question: how would you go about implementing this with Laravel/Lumen? The accepted answer is outdated. I answered and explained a bit how to properly do it in my answer on this question I also posted what is

lumen framework routing not working

大兔子大兔子 提交于 2019-11-29 17:44:18
问题 I use the Lumen framework for first time, the route / to my HomeController is not working. This is my route.php: $app->get('/', 'HomeController@index'); But I get the following error: [2015-04-17 07:03:41] lumen.ERROR: exception 'ReflectionException' with message 'Class HomeController does not exist' in /Users/refear99/Web/qingsongchou_api/vendor/illuminate/container/Container.php:776 Stack trace: #0 /Users/refear99/Web/qingsongchou_api/vendor/illuminate/container/Container.php(776):

laravel excel迁移到lumen

霸气de小男生 提交于 2019-11-29 12:49:41
1、简介 Laravel Excel 在 Laravel 5 中集成 PHPOffice 套件中的 PHPExcel ,从而方便我们以优雅的、富有表现力的代码实现Excel/CSV文件的导入和 导出 。 该项目的GitHub地址是: https://github.com/Maatwebsite/Laravel-Excel 。 2、安装&配置 使用Composer安装依赖 首先在Laravel项目根目录下使用Composer安装依赖: composer require maatwebsite/excel ~2.1.0 安装完成后 1.复制 vendor/maatwebsite/excel/src/config/下的excel.php文件到lumen根目录config文件夹。 2.在lumen的bootstrap/app.php中加入 $app->register(Maatwebsite\Excel\ExcelServiceProvider::class); 3.修改vendor/maatwebsite/excel/src/maatwebsite/excel中ExcelServiceProvider.php文件。 (1)注释boot方法中44-46行代码,config_path在lumen中已经移除。 (3