Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

kenoli's avatar

Having trouble running artisan on an eloquent install without laravel

I installed illuminate/eloquent on my Mac successfully and am very happy with eloquent. However, there are some things I would like to do that require artisan and I can't get it to run. The directions I am given are to enter:

php artisan -list

in the terminal while in the directory where it is installed to get a list of artisan commands. What I get is "could not open input file artisan" . The file is there and I have no trouble opening it myself.

Can anyone help me get artisan running? I wouldn't mind a pointer to a good intro to facades.

Thanks,

--Kenoli

0 likes
4 replies
tykus's avatar

artisan is a script file that ships with a full Laravel project, that requires an Illuminate\Foundation\Application instance (amongst other dependencies), so running it in the context of a project that does not include many Laravel Framework packages is not possible.

siangboon's avatar

here the code in artisan

#!/usr/bin/env php
<?php

define('LARAVEL_START', microtime(true));

/*
|--------------------------------------------------------------------------
| Register The Auto Loader
|--------------------------------------------------------------------------
|
| Composer provides a convenient, automatically generated class loader
| for our application. We just need to utilize it! We'll require it
| into the script here so that we do not have to worry about the
| loading of any our classes "manually". Feels great to relax.
|
*/

require __DIR__.'/vendor/autoload.php';

$app = require_once __DIR__.'/bootstrap/app.php';

/*
|--------------------------------------------------------------------------
| Run The Artisan Application
|--------------------------------------------------------------------------
|
| When we run the console application, the current CLI command will be
| executed in this console and the response sent back to a terminal
| or another output device for the developers. Here goes nothing!
|
*/

$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class);

$status = $kernel->handle(
    $input = new Symfony\Component\Console\Input\ArgvInput,
    new Symfony\Component\Console\Output\ConsoleOutput
);

/*
|--------------------------------------------------------------------------
| Shutdown The Application
|--------------------------------------------------------------------------
|
| Once Artisan has finished running, we will fire off the shutdown events
| so that any final work may be done by the application before we shut
| down the process. This is the last thing to happen to the request.
|
*/

$kernel->terminate($input, $status);

exit($status);

what are you expecting it to run on your environment without Laravel and other components??

if you just want to start a web services (without setup apache and so on) so you can access it with browser, you can use this

php -S localhost:8000

by the way, php artisan do not have option with -

php artisan list instead of php artisan -list

kenoli's avatar

Thanks. Well that answers my question, though I'm confused because got the Artisan command and instruction from a page that showed me how to install eloquent without Laravel and gave the artisan command as well as some queries tools that required artisan. It is a Stackify tutorial with examples using artisan as well as other queries that don't require it.

What I was hoping to run were some DB:: queries. Artisan was installed in my vendor directory along with a bunch of other stuff. It is at vendor>illuminate>support>facade>Artisan.php.

I'm running xampp for a php server. Couldn't get the local Mac installation to work. I wrote the terminal command from memory and got it wrong. I was running it correctly in terminal.

I love the part of eloquent I was able to get working. It makes quick work of CRUD.

Confused...

Thanks,

--Kenoli

kenoli's avatar

PS -- This is the code in my Artisan.php file:

Please or to participate in this conversation.