简体   繁体   中英

access laravel session in 3rd party plugin

Am using laravel 4.x framework for a project and i have a simple 3rd party chat application which i have put in my public folder of the laravel project.

Now comes the problem the 3rd party chat app requires the session data from laravel.

But am not able to get the laravel session into my chat app.Its because the laravel handles session differently and therefore $_SESSION is not giving me any options.

I would like to know how to call laravel session from another script.

OR

simply say how do i access the laravel session from my public folder from a php file.

Please guide me.

Thankz.

this probably not 100% solves your problem, but you can try something like:

// from bootstrap dir laravel application
require __DIR__.'/../bootstrap/autoload.php';
$app = require_once __DIR__.'/../bootstrap/start.php';

After those lines above now you can access laravel session use facade:

Session::get('key');

or function

app('session')->get('key');

good luck !

Finally got a link which worked for me...

http://www.laravel-tricks.com/tricks/integrating-laravel-4128-with-3rd-party-libraries

Hope this will help others..

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM