Add Laravel resources to an existing project

Asked

Viewed 71 times

-2

I’m new in the world PHP and Laravel, but I joined a project that the original team has no contact with and I’m in a demand and I didn’t want to put in CRON the execution of e-mail routines.

This project does not have the standards of Laravel, but some features I understand are from Laravel, I am deducing from what I found in Composer.json that has the following structure.

"require": {
        "slim/slim": "3.0",
        "guzzlehttp/guzzle": "6.5.3",
        "stavarengo/php-sigep": "dev-master",
        "illuminate/database": "*",
        "tuupola/slim-jwt-auth": "^2.4",
        "illuminate/pagination": "~5.0",
        "phpmailer/phpmailer": "^6.0",
        "sofa/eloquence": "^5.6",
        "google/apiclient": "^2.4",
        "mailgun/mailgun-php": "^2.8",
        "kriswallsmith/buzz": "^0.16.1",
        "nyholm/psr7": "^0.2.3",
        "php-http/guzzle6-adapter": "^1.1",
        "php-http/message": "^1.7"
    }

Through the Laravel documentation I found the Illuminate Console Scheduling Schedule and Illuminate Foundation Console Kernel libraries which would allow me to develop this task scheduling, I am sure in my understanding?

Could I install only these features via Composer? How should I? Or I could add Laravel to my project, but gradually migrate to Laravel structure?

I appreciate the help.

  • 1

    Yes you are right in your understanding about scheduling using Laravel’s Schedule. Take into account that Schedule will need a process running on the server equal to CRON. Since you make use of Laravel, it would be interesting to use the entire framework, don’t you think? I’m no expert on Laravel either, but I don’t think Schedule will work without the framework’s "core".

  • Hello James I started this study to put completely in Laravel, but as this first version is already in the homologation phase I will need to create this schedule, but I will follow your advice and at this time use via CRON. Thanks for the help.

1 answer

1

Hello, by the dependencies of this project is done in Slim framework, which does not have a library for scheduling tasks, it is necessary to implement one, searching in the packagist found this https://packagist.org/packages/peppeocchi/php-cron-scheduler, can join it to phpmailer that is already installed in this project and develop an email triggering scheduling service, I do not know Slim well and I regret I can not help more.

  • 1

    I thank Emmanuel, I will study this possibility, who knows solved my problem.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.