Skip to content
Advertisement

Bootstrap with composer

I’ve downloaded bootstrapp with composer

composer.json

JavaScript

and I’ve included the autoload file on index.php

JavaScript

Bootstrap its downloaded on vendor folder but it’s not working I guess I also have to add this line to the html code

JavaScript

Am I right? or there is any way to work bootstrap only with

JavaScript

Advertisement

Answer

Composer is for managing your PHP dependencies, which appears to be your backend technology of choice. However, a UI framework, such as Bootstrap, is a frontend dependency (CSS and JS). Your proposed way of referencing the CSS in your HTML is the way to go:

JavaScript

Same for jQuery and the Bootstrap JS:

JavaScript

It’s probably easiest for you if you embed it from a CDN as in my examples. If you want to serve the files yourself you could use bower to manage your frontend dependencies (although I think that is discontinued).

Your composer auto load script, however, is not what you need for this.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement