calling route of Laravel project with Exec command - php

I've a project in Laravel 5, and I need to call a route of other project made in the same framework, I was thinkg in call this route using exec command of PHP, is possible to call a route?I've been callin PHP scripts and it works fine, but now I need to call a route an get the response. The reason of why I'm doing this of this way are a lot so I'll not explain it here or the post will get very long. Thank you!

Related

Laravel call to controller method from command line to run in background

I have method in laravel controller with some logic that need to run in the background in an infinite loop. With core php with was simple as we used to set it nohup php and call the php file to run in the background. How could we do the same with laravel to run the things in background.
Note: I cannot use cronjob for this as its an infinite loop which need to kept running in the background
Kinda hard to imagine what task you want to accomplish, but you could create laravel command, which could call controller method directly.
How to call controller method from within command
Check comment under the answer to resolve controller correctly.
Next, you should run command by the supervisor.
Supervisor tutorial
you can use define cronjob on your linux machine or use laravel schedule library . look at the following link :
https://laravel.com/docs/5.1/scheduling

Typo3 scheduler: Can i somehow execute Action of controllers of my extension with it? Or how to run my own code with it?

A while ago i was tasked to program a Typo3 extension to write so called .conf files for the icinga2 montoring tool (has nothing to do with Typo3). Still let me explain some parts of it: Basically the backend user needs to create records of records of specific classes and set values for each records properties. Then i need to process the records to create these .conf files with the specific values with a php script.
I was tasked to use the scheduler in Typo3 for this. And here come the problems: How do i use this? I checked the documentation (https://docs.typo3.org/typo3cms/extensions/scheduler/Introduction/Index.html), but i still can't wrap my head around how to use it for my task. I can easily write an Action in a controller of a class to be executed in the frontend and in turn generate the con files... basically manually without the scheduler. But where do i put my php code to be run by the scheduler? I somehow seem not to understand the basical principle of the scheduler. Can i just run an Action of a specific controller of a class of my extension like i would in the Frontend via the scheduler?
I would suggest you use a command controller for this task.
The documentation shows how to create a command controller, which also may accept arguments.
Command controller tasks can directly be executed by TYPO3 scheduler (see screenshot below)
You may even configure task arguments for command controller tasks in TYPO3 scheduler.

How to call CLI from a controller on ZF2

Our system is written in ZF2. I'm trying to call a ZFTool console command programmatically, if there's a way to do that. All documentation I have found so far points to call a Controller action from CLI, instead of CLI programmatically from a controller.
If there's no default way to do this, a workaround would be fine as long as it's testable. Thanks in advance.
PS: I'm new to ZF2, I come from Laravel where you have a facade class to execute commands from a controller class Artisan::call('my:command').

Using node modules in Laravel

I am trying to include this module: https://www.npmjs.com/package/react-datepicker-component with react into my Laravel Framework.
I went on to using npm to install it but I am getting no where after that.
I could use some direction. Has anyone tried using NPM for Laravel other than for Laravel Elixir?
I was stuck with this same issue for about an hour trying to pull in the inputmask node package.
The only way I was able to get it included was by attaching it to the window object in app.js (similar to what bootstrap.js does)
window.InputMask = require('inputmask');
If you don't want to load it every time (as it would with app.js) you can create a separate js file that contains only the line of code above and load that on select pages. I feel like there has to be a better way, but this is the only way I've found to make it work.

laravel error first step

I installed Laravel-4 on my MAC, its all good until i try to do something.
I tried to follow the tutorial on website, which is the basic route here http://laravel.com/docs/quick
When i tried to open, its an error with message: Class Route not found on routes.php
I barely use framework PHP, so should i make a class for it or what do they want?
Is there another way to test that i could use the Laravel-4 php , like the hello-world ?

Categories