5

I have one problem I have no ssh access to the server, so I cannot use php artisan, composer and other commands.
As I can quess they do nothing other than modifying files or just copying php src files to specific directories.
In order to understand that process better and because of no access via ssh to the server I am looking for tutroial, manual or an article how can I perform this commands manually.
For example I need to execute

php artisan vendor:publish --provider="Tymon\JWTAuth\Providers\JWTAuthServiceProvider"

What should I do in this case, it would be grate to find some document describes what should I do manually to get the same result.

2 Answers 2

1

Laravel provides a handy Facade for artisan commands.

Just use Artisan::call('your-command') from where you need.

Example:

Route::get('artisan-command/{command}', function($command) {
    Artisan::call($command);
});

Your URL looks like this: http://yourhost.com/artisan-command/db:seed

More specific for your use-case:

Route::get('vendor-publish/{provider}', function($provider) {
    Artisan::call('vendor:publish', ['provider' => $provider]);
});

And the URL: http://yourhost.com/vendor-publish/Tymon\JWTAuth\Providers\JWTAuthServiceProvider

Reference: Artisan Console in the Laravel Docs

Sign up to request clarification or add additional context in comments.

1 Comment

and how to run php composer.phar require laravel/ui ? is there any Composer::call or still using Artisan::call ?
-1

You can execute command lines from your app. You can do something like this:

Route::get('execute/my/command', function(){
    exec("php path/to/your/project/artisan your-command",$resultLines);
    Foreach($resultLines as $resultLine){
         echo $resultLine;
     }
});

First exec property is your command and second is variable to save the result. I hope that help you

1 Comment

This is assuming 'exec' is enabled on the server. Given that the OP has no SSH access it seems unlikely.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.