Managing Libraries like Bootstrap 5

I have a code base running on the Laminas MVC framework.
For a very long time, I have installed libraries manually.

I am hoping to use Composer to manage some libraries like Bootstrap 5 ( https://getbootstrap.com/docs/5.0/getting-started/download/#composer).

I can’t seem to create a path to them using $this->basePath from the layout.phtml file as the library is placed in the vendor directory

What is the best way to handle manage a library like Bootstrap 5 using Composer?

Hello and welcome to our forums! :smiley:

Do not use Composer to install Bootstrap! :wink:

You can use Composer to copy the related files.
But the problem is that Bootstrap may be able to be installed with Composer, but this is not guaranteed for the next frontend library. npm, Yarn or something similar are probably better suited here.


Check also the “TwbsHelper” module for integration of Bootstrap in a laminas-mvc based application. In the documentation you will also find the description of the installation, which uses an assets management.

2 Likes

Thanks for sharing this awesome resource @froschdesign !