ThemeDownloader v0.1: apply Bootstrap theme with Artisan command

We’ve just released a first “alpha” version of a package called ThemeDownloader – need your opinion, feedback and requests for future improvements. Basically, you can get a Bootstrap-based front-end theme into your Laravel project, just by launching one Artisan command.

Without a theorical explanation, let’s see it in action.

Theme 1. Landing Page

Let’s say we have a fresh Laravel 5.5 installation with this view.

laravel new installation

Now, we install our package and launch the command to download the theme called Landing Page:

Here’s the result:

laravel theme download

Now, we have a new set of files in resources/views/landing-page folder, leading with a new welcome.blade.php:

laravel resources views

Now, all we need is to change our routes/web.php and apply our newly created Blade file:

And here we go – our Laravel homepage looks like this:

laravel landing page

Now, this package only downloads the front-end files and converts them to Blade language, but it doesn’t add any back-end logic. So, in this case, sign up form won’t work and other links won’t be clickable, you need to customize it yourself. But it helps you to have Blade structure and not to worry about it.

What package also does is downloading the related assets (CSS / JS / images) to public/vendor folder, also putting them into a separate theme folder to avoid conflicts:

laravel public landing page folder

Theme 2. Classimax – Classified Directory

We start by supporting two themes in our version 0.1.

So another free Bootstrap-based theme we support is Classimax – a classified directory of companies, but technically you can apply it to any marketplace / e-shop / catalog.

We’re launching the same command, just with a different theme parameter:

And this theme is more complicated than just one landing page – it has multiple pages, with included partials and more assets. So it takes longer to download, but then we have this in resources/views/classimax:

laravel classimax views

And also quite a lot of images in public/vendor/classimax:

laravel classimax images

In this case, we also have a new ClassimaxController.php file and routes/classimax.php:

Finally, in routes/web.php the package adds this one line:

Notice: of course, you can change the logic how this route file is loaded – by just copy-pasting its routes to main routes/web.php or registering it in RouteServiceProvider.

As a final result, we have this page:

laravel classimax homepage

In this case, all the links should be clickable, but each of them represents just static page without any logic – here’s ClassimaxController.php file:

So it’s up to you to add your logic for the directory or remove any unnecessary pages.

Where does it all come from?

You probably wonder how we download themes and how it all works, in general. It’s pretty straightforward, actually.

1. We’ve downloaded both themes from their official sources and put into a separate repository:

laravel themes repository

2. When running Artisan command, we perform Guzzle request to our files – Github gives us public URLs for them.

Basically, that’s it.

The idea is that future themes, if any, will be added to that separate repository, and in case of theme changes, again – we can update that theme repository, without updating the main package.

Though, actually, for now it’s not that flexible – current two themes are “a little hard-coded” in version 0.1. We will wait for the feedback from the community before proceeding with more themes.

Speaking of which, we need your opinion! So please try out the package and put in the comment below in the form, we will appreciate it!

Any more themes you would like us to support? Or maybe you’re a theme creator which you want us to adapt to Laravel?

Link to the package again:

Want more tips and articles like this?
20-50 useful links every week on our weekly newsletter - comes out every Thursday!

3 thoughts on “ThemeDownloader v0.1: apply Bootstrap theme with Artisan command

  1. Really awesome package! Will make things a lot faster in the future and I foresee many contributors adding new sites and templates.

    One suggestion is this:

    For example on clasimax, there is products, to have those in a JSON file and using a foreach with blade instead of rewriting the product cards.

    1. Thanks! We were thinking how to do it the best way – then we go into the field of back-end – how to fill in the data into the blade files. I guess we will have to integrate a few more themes to see what is the best pattern here.

Leave a Reply

Your email address will not be published. Required fields are marked *