Bootstrap 5 asset publisher for CodeIgniter 4.
This package adds a Spark command that publishes the Bootstrap distribution files from Composer dependencies into your public directory.
- Installs Bootstrap with Composer
- Publishes only the Bootstrap production assets
- Works with CodeIgniter 4 auto-discovery
- Keeps Bootstrap asset publication explicit and framework-oriented
- PHP 8.2 or newer
- CodeIgniter 4.7.2 or newer
- Bootstrap 5.3.8 or newer within the 5.3 branch
Install the package in your CodeIgniter 4 project:
composer require domprojects/codeigniter4-bootstrapIf you also want automatic publication after composer install and composer update, install the companion plugin:
composer require domprojects/codeigniter4-bootstrap-pluginThe plugin package is optional. This main package works on its own.
Publish assets manually:
php spark assets:publish-bootstrapForce overwrite existing files:
php spark assets:publish-bootstrap --forceThe package publishes these files:
css/bootstrap.min.csscss/bootstrap.min.css.mapjs/bootstrap.bundle.min.jsjs/bootstrap.bundle.min.js.map
Files are published to:
public/assets/bootstrap
Example in a CodeIgniter view:
<link rel="stylesheet" href="<?= base_url('assets/bootstrap/css/bootstrap.min.css') ?>">
<script src="<?= base_url('assets/bootstrap/js/bootstrap.bundle.min.js') ?>"></script>src/
Commands/
PublishBootstrap.php
Publishers/
BootstrapPublisher.php
If you want to work on the package locally from another project, you can use a Composer path repository.
Example:
{
"repositories": {
"domprojects-codeigniter4-bootstrap": {
"type": "path",
"url": "packages/domprojects/codeigniter4-bootstrap",
"options": {
"symlink": false
}
}
}
}If you also test the automation plugin locally, add a second path repository for packages/domprojects/codeigniter4-bootstrap-plugin.
domprojects/codeigniter4-bootstrap-plugin: optional Composer plugin for automatic publication
MIT