Andréas Posted December 9, 2015 Share Posted December 9, 2015 Hi folks,I've been playing a lot with Laravel and Prestashop this days and came up with a Prestashop's module that let you build other Prestashop's modules using Laravel API and philosophy.You might want to check it out :https://github.com/dedesite/illuminatoIt's still a work in progress and it's not production ready but I wanted to know if people were interested in such project.If so, please let me know by staring the projet on github, forking it, report bugs, ask for features etc.Hope you'll enjoy it,Andréas 3 Link to comment Share on other sites More sharing options...
mkwsra Posted May 11, 2016 Share Posted May 11, 2016 This topic is so much interesting... It will be a revolution to build such kind of bridge between these lovely tools.I hope you will keep working on it... and a bit of time later I'll have more knowledge in Prestashop.. I'll be more than happy to contribute into your project.Wish you the best and good luck Link to comment Share on other sites More sharing options...
Andréas Posted May 11, 2016 Author Share Posted May 11, 2016 Hi, Thank you for your repply. Unfortunetly this tools will never be able officially to Prestashop cause it requires php 5.5 at least and some modification to prestashop core. I stop working on it but got pretty far, I was able to do migrations, use ORM, localisation and a lot of things the Laravel's way . The module creation was also quite simple and strait forward, I took inspiration from October CMS which is the greatest CMS I know. If you need more information or need help playing with illuminato, don't hesitate. If people show some interest I'll maybe consider working on it again. Link to comment Share on other sites More sharing options...
SkyBladeCloud Posted May 16, 2016 Share Posted May 16, 2016 (edited) This a pretty amazing project. I've been using it for several tests and I believe it has quite a lot of potential. However, I have a doubt i hope the author can help me with. You see, in one of my tests I wanted to use an additional function within the module ("public function test()"): <?php if(!defined('_PS_VERSION_')) exit; class LaravelModule extends Illuminato\Module { public function moduleDetails() { return [ 'namespace' => 'LravelModule', 'tab' => config('LravelModule::module.tab'), 'version' => config('LravelModule::module.version'), 'author' => config('LravelModule::module.author'), 'displayName' => config('LravelModule::module.name'), 'description' => config('LravelModule::module.description'), ]; } public function install() { if (!parent::install()) return false; return true; } public function getContent() { return view('LravelModule::backend' ]); } public function test() { //return 'Hi there!'; //WORKS! return view('LravelModule::exampleView'); //DOESN'T WORK! (It only works when "test()" is called from "getContent") } } However, just as I comment in the example above, I seem to be unable to call Laravel helpers (or use any of its classes/methods, for that matter) from the additional function, they seem to work only from the "getContent" method, or any other method called from it. Trying to extend laravel's functionality to this kind of additional methods has led me to a dead end. Any pointers? --- My original idea was to emulate Laravel's controller funcionality using another PHP file that would act kinda like the usual "routes" file in Laravel: <?php $functionData = preg_split('@/@', $_SERVER['PATH_INFO'], NULL, PREG_SPLIT_NO_EMPTY); echo $functionData[0]($functionData); function helloWorld($arguments) { return 'Hello World'; //WORKS } function test($arguments) { return view('LaravelModule::exampleView'); //DOESN'T WORK } This way I can trigger those two functions by accessing their respective URLs: www.myshop.com/modules/laravelmodule/routes.php/helloWorld -> which works and returns the correct "Hello World" string. www.myshop.com/modules/laravelmodule/routes.php/test -> which doesn't work, apparently beacuse it uses a laravel function (the same thing that happens in my first example). Thanks for your time: ~Sky EDIT: Alright I figured it out. It's a matter of bootstrapping the framework again in the file that will use methods from Laravel. Here is an example based on my "services.php" example from above: <?php include_once '../../config/config.inc.php' ; require _PS_MODULE_DIR_ . '/illuminato/src/bootstrap/autoload.php'; require_once _PS_MODULE_DIR_ . '/illuminato/src/Module.php'; $app = require_once _PS_MODULE_DIR_ . '/illuminato/src/bootstrap/app.php'; $kernel = $app->make('Illuminate\Contracts\Http\Kernel'); $response = $kernel->handle( $request = Illuminate\Http\Request::capture() ); //Use the languge specified in PrestaShop's configuration $context = \Context::getContext(); $app->setLocale($context->language->iso_code); $functionData = preg_split('@/@', $_SERVER['PATH_INFO'], NULL, PREG_SPLIT_NO_EMPTY); $response->content = $functionData[0]($functionData); $response->send(); $kernel->terminate($request, $response); function helloWorld($arguments) { return view('LaravelModule::exampleView');//IT FINALLY WORKS! } Please, note that, for the above example to work, I had to make a couple of modifications to the framework: -Marked the "content" attribute of the response as public (I know it's a hack; it's supposed to be modified by the routing engine, but that's not available in Illuminato... yet? You may want to do the same with the "statusCode"/"statusText" member variables). -Added the "terminate" method to the app class (IDK why it wasn't in Illuminato, it doesn't do much but it can't hurt to have it, either ). Hope it helps: ~Sky Edited May 23, 2016 by SkyBladeCloud (see edit history) Link to comment Share on other sites More sharing options...
prestasafe Posted March 7, 2018 Share Posted March 7, 2018 Very very interesting ! Thanks for this project ! Are your still working since prestashop 1.7 and SF implementation ? Thanks Link to comment Share on other sites More sharing options...
Andréas Posted March 7, 2018 Author Share Posted March 7, 2018 Hi, thanks for your feedback. The project is unfortunately dead and I do not work on Prestashop any more. I guess, it's not a useless project since PS 1.7 is now based on SF, which is a really good news ! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now