Voyager – Can an Admin UI Make Laravel Even More Approachable?
Today, we are talking about Voyager!
Voyager is a Laravel package that provides a full administration system for the framework in its “skeleton app” form. Voyager has 4 main features:
Media Manager – Built on top of Intervention Image, it provides a fully functional media manager that allow us to view, edit, and delete images from storage. This way, we can have all of our media in a single place, making it easy to access and manipulate.
Menu Builder – The Menu Builder allows us to add, edit, and delete menu items. It also gives us the ability to create new menus and manage them.
Database Manager – Allows us to access and manipulate our database directly from the admin panel. Instead of having to use Laravel’s
Schema, Voyager provides us with a mechanism to add, delete, and edit entries in the database. It will also (upon specification) create our models when adding tables to the database.
Bread/CRUD builder – BREAD is simply CRUD for the database. Voyager provides a mechanism to Browse, Read, Edit, Add, and Delete entries and views of any table in our database.
Let’s take a closer look at it.
First, let’s start with a fresh Laravel installation. Of course, we can start with an existing project, but for the purpose of this article we will start with a fresh one.
While it’s outside the scope of this article, the recommended way to start a new Laravel project is by using Composer:
composer create-project laravel/laravel voyager
This will create a new Laravel project called
voyager inside the
/voyager folder. To serve this new Laravel project, using PHP’s built in server:
php artisan serve
On Homestead Improved, the serving is taken care of for you with Nginx.
With a fresh Laravel installation up and running, we can now focus on installing the Voyager Admin package.
composer require tcg/voyager
As we can see during the installation process, Voyager is pulling components from some very well known PHP packages like Doctrine ORM for the database manager, or Guzzle and Intervention Image for PHP image handling and manipulation. This shows us that Voyager is built on top of reliable and proven components.
Next, let’s fire up our favorite code editor. We will need to edit some files in order to have Voyager up and running.
First, we open the
.env file and add our database credentials so that Voyager can connect to it.
DB_HOST=localhost DB_DATABASE=database DB_USERNAME=username DB_PASSWORD=password
After that, let’s add the Voyager and Image Intervention service providers to our providers array. This array can be found in the
config/app.php file, and all we need to do is append the following elements to it:
To finish the installation:
php artisan voyager:install
We should now see the
"Successfully installed Voyager! Enjoy :)" message.
Continue reading %Voyager – Can an Admin UI Make Laravel Even More Approachable?%