Skip to content
This repository has been archived by the owner on Feb 16, 2022. It is now read-only.

Usage with Laravel

TheUltraGrey edited this page Feb 6, 2017 · 1 revision

Using Web Composer within a Laravel project.

Installation

First we begin by installing the library using composer -locally if you don't have shell access- as follows:

composer require grey-dev-0/web-composer

After composer finishes downloading go to config/app.php file then add the following to the providers array:

GreyDev\WebComposer\WebComposerServiceProvider::class

Then open app/Http/Kernel.php then add the following to the $routeMiddleware array:

'web-composer.tasks' => \GreyDev\WebComposer\WebComposerMiddleware::class

Now we need publish the views of the library to your project to do that we open shell or terminal locally and write:

php artisan vendor:publish --provider="GreyDev\WebComposer\WebComposerServiceProvider"

Configuration

Now before starting the library you can assign your authentication middleware to the library's route group and, also you change the prefix segment of the library's routes in config/web-composer.php.

By default the library is accessible on http://your_domain/composer and is not protected by a login, so that you can add your login mechanism by assigning your own login middleware name to the middleware setting in the mentioned config file, and if you'd like to change the composer prefix in the URL to something else you can assign whatever route you'd like in the prefix setting in that file as well.

Usage

The library is ready to use by now, you can access it on the set URL, if you've assigned a middleware for logging in then you will be automatically redirected for your login page, after logging in you'll be looking at the list of the packages already installed in your project, in that page you can update and remove any of these packages.

The other page is the listing of all packages where you can install new ones into your project, all operations are handled internally by composer and the output of them is written to the minimized console at the bottom of the screen.

Note about Web Composer's console

The console at the bottom of the page is not synchronized with the operations handled on server in real time and, there is a continuous sync function that runs when any operation is requested e.g. a new package install, and there is a switch button beside the console button that toggles that function on and off, so if there is a background operation running and the sync function isn't working you can switch it on by clicking that button, and if you've requested an operation and don't like that sync function to bother the server with repetitive requests you can switch it off using the same button.