Trying to call third party cosole function from my laravel application - laravel-5

Am trying to use this brilliant app easybook-project with my laravel ebooka applicatin but the app I have mentioned uses console commands. Is there anyway I can consume this console commands from my laravel ebook application for ebook conversion?

I would use the normal PHP exec command, to call the 3rd party commands.
Please find the link for the documentation.

Related

How to get Rest Api endpoints, name and url's, in the way Azure Functions do?

Sometimes you get over a feature that you just like. When creating a Azure Function project and debugs it, it writes out this nice info in the console.
Now that I am writing the frontend, I have found this information very useful.
Functions:
CoWorkers: [GET,POST] http://localhost:7071/api/CoWorkers
GetManager: [GET,POST] http://localhost:7071/api/GetManager
SetManager: [GET,POST] http://localhost:7071/api/SetManager
UserInfo: [GET,POST] http://localhost:7071/api/UserInfo
...
I would like to have this on every asp.net rest api project that I am coding.
Anyone knows how to get it?
EDIT: OpenApi/Swagger is providing this information as pawelek91 says and I should have mentioned that I want it in the console: "Just because I like that feature".
use HttpOption request or swagger (if you can install it on your backend)
For console access to your web API, try the new HttpRepl tool at:
https://learn.microsoft.com/en-us/aspnet/core/web-api/http-repl/
It's a dotnet CLI tool that is installed separately (install using dotnet tool install -g Microsoft.dotnet-httprepl from the CL). Then you can "browse" your API using this command line tool.
As noted in the docs, it requires .Net Core 2.1+.

Executing a Route (Controller/Action) using PHP CLI and Detecting a CLI Request

Is there a way in Laravel 4 to run my controller/action using PHP-CLI? I have a controller/action that I would like to extend to perform an alternative action if the request comes from the CLI, so is there a way to identify the request as a CLI request?
The Laravel documentation on this site seems to suggest that there is a method Request::cli() for determining if the current request is via the Artisan CLI but when I used the method in Laravel 4, it throws an error:
Call to undefined method Illuminate\Http\Request::cli()
Basically, I have just moved from CakePHP to Laravel and would like to accomplish something similar to as what's described in this article (for CakePHP) : Calling controller actions from cron and the command line
I understand that I can work with Laravel 4 Artisan Commands, but is the approach I would like to use possible? And if so, how?
As Rob already said, to determine if the current script is being run in the console use App::runningInConsole() or simple plain PHP php_sapi_name() == 'cli'.
As for running controller#action from console, you could use curl or wget to request one of your routes but I think the proper way of doing it would be to use a custom artisan command. Your controllers are classes so you can instantiate them and use as you please from within your artisan command:
$controller = new SomeController;
$controller->someAction();
Watch this video for an introduction to easily developing your own artisan commands.

Can this be done? Bash script in a web application

I have a bash script (supports linux/unix), that installs an application.
Instead of executing the script in the terminal, I want to deploy it as a web application.
I want to make a web graphical interface for this script, so that the user can give the necessary inputs in the web forms and when ready,then pass these variables into the bash script to be executed.
This script obvious needs root privileges.
I plan to make it with with tomcat 7 / servlet / jsp. I want to deploy it as .war file.
First, can this be done? Is it possible?
Second, is there any example? I didn't find anything.
Third, any alternative method/better idea?
I'd try tomcat's own CGI support.
http://tomcat.apache.org/tomcat-6.0-doc/cgi-howto.html
Well, it's possible, but keep in mind that sanitizing user input is hard.
What you want to do is use a scripting language or framework (I recommend sinatra), and use a html form to pass arguments to the backend. In the backend, you call your script by passing whatever arguments you want.
Example with sinatra:
post '/whatever' do
# This is dangerous!
`myscript #{params[...]}`
end
Err, but you want this to run on the client side, right?
So you don't really run it as bash on your system, you just template it within your web framework.
If the browser can then display this, it won't just d/l as a file, so you will need to set up a Content-Disposition: attachment header in the response to force a d/l.
You will naturally need the user's cooperation to run this as root on his or her system...

Is there a way to retrieve Heroku logs over HTTP?

I'd like to access Heroku logs for an app without using the command line. Is this possible?
Yes, you can. It's a simple REST API. There aren't any JavaScript wrappers for the API, but you can use these as reference implementations, or use them directly:
https://github.com/heroku/heroku.jar
https://github.com/heroku/heroku.rb
https://github.com/heroku/heroku.py
Currently No. If you're looking to use this from within a Ruby based app you can embed the heroku gem and use it programatically which might help.

Codeigniter bootstrap for PHP CLI

I am developing a PHP CLI tool, which I want to bootstrap with CodeIgniter to be able to use some of it's libraries, like database and accessing configuration.
So basically I want to have a CLI script, that would allow me to load up the CodeIgniter environment and then do $CI->db->stuff().
I know that I could create a controller for this but I am looking for a way to make it CodeIgniter-installation-independent, so that I could simply $ cd into a dir, load it's CI environment and perform magic via command line. Another reason why I don't want to use a controller is that I don't want it to be accessible to public via address bar.
So, any ideas?
Command line capabilities are baked into the latest version now. Enjoy:
http://codeigniter.com/user_guide/general/cli.html

Resources