lumen

Sessions not persisting in Lumen PHP framework

夙愿已清 提交于 2019-12-09 16:59:16
问题 I'm using the Lumen (by Laravel) micro-framework for a project, and I'm having some trouble with sessions. I'm just testing the implementation now, but the problem I'm experiencing is that when I set a session variable and then refresh the page, the variable is no longer set. In my .env file I have: SESSION_DRIVER=cookie And I know that this is being picked up, because when I change it to memcached it throws an error (because I don't have memcached set up). I've enabled the middleware too:

Laravel 5 / Lumen Request Header?

依然范特西╮ 提交于 2019-12-09 08:21:39
问题 So I am not really sure how to go about this I have tried a few things and I will list one below however what I am trying to do is store information sent in a http request in a PHP variable. Here is a view from Chrome Postman of me sending the request I want ot send. Note "pubapi" is a "header". I have been messing around with Lumen requests as you can see documented here ( http://lumen.laravel.com/docs/requests ) and have tried using the following below to possibly display them but its not

Supervisorctl does not auto-restart daemon queue worker when hanging

旧时模样 提交于 2019-12-08 07:33:27
问题 I have supervisorctl managing some daemon queue workers with this configuration : [program:jobdownloader] process_name=%(program_name)s_%(process_num)03d command=php /var/www/microservices/ppsatoms/artisan queue:work ppsjobdownloader --daemon --sleep=0 autostart=true autorestart=true user=root numprocs=50 redirect_stderr=true stdout_logfile=/mnt/@@sync/jobdownloader.log Sometimes some workers are like hanging (running but stop getting queue messages) and supervisorctl does not automatically

Laravel: changing from Blade to JS frontend framework

主宰稳场 提交于 2019-12-08 07:05:00
问题 I have a Laravel application which is using Blade as the frontend. I'm feeling the better (more future proof) option would be to switch to Angular, Vue or React, (not entirely sure yet which one I will use but that's not the question of this post) I've always thought that the backend code should expose an API in order for these JS frontend frameworks to work. I currently don't expose any sort of API. I basically designed it in the normal way: define route pointing to controller create

Playing Video - Server is not correctly configured - 12939

此生再无相见时 提交于 2019-12-08 04:19:57
问题 I have an ios app with laravel (lumen) on the server side. I am trying to play the videos in the server, on application. I am using a Player that plays videos with a direct link (e.g vine video link), however when I save the same vine video on my local server, the application doesn't play the video. In fact, when I try the video with my api route, surprisingly it plays the video on Chrome! But on the application end, I receive error: The server is not correctly configured - 12939 (Please note

Lumen API CORS Ajax 405 Method Not Allowed

痴心易碎 提交于 2019-12-08 03:20:22
问题 I have an api on Laravel Lumen, we test via Postman and Ruby Rest Client and all go very well, but we create a simple Auth Login that response a web token, all works fine but on our React App actually we have this "405 405 Method Not Allowed". We create a class with the next code: <?php namespace palanik\lumen\Middleware; use Closure; use Illuminate\Http\Response; class LumenCors { protected $settings = array( 'origin' => '*', // Wide Open! 'allowMethods' => 'GET,HEAD,PUT,POST,DELETE,PATCH

upload image ionic 3

两盒软妹~` 提交于 2019-12-07 22:29:54
问题 I am developing an app in ionic 3 and need to upload image to server using an api created in lumen framework. The request to upload image is : The image is clicked from camera and converted to base64. let base64Image = 'data:image/jpeg;base64,' + imageData; Then i use FileUpload to upload image import { FileTransfer, FileUploadOptions, FileTransferObject } from '@ionic-native/file-transfer'; buildHeadersDeals(){ this.header = new Headers(); this.header.append('Authorization', 'Basic ' +btoa(

How to use Laravel passport for Auth and Lumen as api

一曲冷凌霜 提交于 2019-12-07 20:09:24
问题 I am researching for develop an API consumed application using laravel, laravel passport , lumen and AngularJS I have 3 domains as follows auth.dev - Laravel 5.4 + Passport oAuth server ( as a auth server ) api.dev - Lumen ( as a API seaver ) app.dev - php + angularjs ( single page app ) I can not properly configure those 3 together. I have setup auth.dev and it will successfully generate Tokens and I can use them from app.dev . But my requirement is use 3 separate instance for API, Auth and

Docker + Laravel queue:work

落爺英雄遲暮 提交于 2019-12-07 10:39:08
问题 I'm trying to run the following command after the container is up and running. php artisan queue:work -n -q & The "&" is there because the daemon option was deprecated and later removed from Laravel. However, this breaks my container startup completely. CMD ["php", "artisan", "queue:work", "-n", "-q", "&"] How should I do this in a Docker way? EDIT: Using docker-compose I added this line to my docker-compose.yml file command: bash -c 'php artisan queue:work -n -q;' The container started but

How to dispatch a Job to a specific queue in Lumen 5.5

孤人 提交于 2019-12-07 03:55:45
问题 In standard a job I use this method to dispatch a Job: dispatch(new PurchaseJob($trxId, $method, $params)); Next I want to dispatch another Job to send email, but I want to split it to another separate queue. From what I read on Laravel 5.5 docs I could do this: SendEmailJob::dispatch($userEmail)->onQueue('send_email'); But it does not seems to work on Lumen 5.5. What could I do to make this work or is there any other method that are not stated in the docs? 回答1: I just managed to find a way