Jrop Jrop - 1 year ago 135
PHP Question

How do I write to the console from a Laravel Controller?

So I have a Laravel controller:

class YeahMyController extends BaseController {
public function getSomething() {
Console::info('mymessage'); // <-- what do I put here?
return 'yeahoutputthistotheresponse';

Currently, I'm running the application using artisan:

php artisan serve

I would like to log console messages to the
pipe for the artisan process.

Answer Source


This can be done with the following PHP function:

error_log('Some message here.');

Found the answer here: Print something in PHP built-in web server

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download