|
| 1 | +# domProjects CodeIgniter 4 Bootstrap |
| 2 | + |
| 3 | +Bootstrap 5 asset publisher for CodeIgniter 4. |
| 4 | + |
| 5 | +This package adds a Spark command that publishes the Bootstrap distribution files from Composer dependencies into your public directory. |
| 6 | + |
| 7 | +## Features |
| 8 | + |
| 9 | +- Installs Bootstrap with Composer |
| 10 | +- Publishes only the Bootstrap production assets |
| 11 | +- Works with CodeIgniter 4 auto-discovery |
| 12 | +- Keeps Bootstrap asset publication explicit and framework-oriented |
| 13 | + |
| 14 | +## Requirements |
| 15 | + |
| 16 | +- PHP 8.2 or newer |
| 17 | +- CodeIgniter 4.7.2 or newer |
| 18 | +- Bootstrap 5.3.8 or newer within the 5.3 branch |
| 19 | + |
| 20 | +## Installation |
| 21 | + |
| 22 | +Install the package in your CodeIgniter 4 project: |
| 23 | + |
| 24 | +```bash |
| 25 | +composer require domprojects/codeigniter4-bootstrap |
| 26 | +``` |
| 27 | + |
| 28 | +## Optional Automation Plugin |
| 29 | + |
| 30 | +If you also want automatic publication after `composer install` and `composer update`, install the companion plugin: |
| 31 | + |
| 32 | +```bash |
| 33 | +composer require domprojects/codeigniter4-bootstrap-plugin |
| 34 | +``` |
| 35 | + |
| 36 | +The plugin package is optional. This main package works on its own. |
| 37 | + |
| 38 | +## Spark Command |
| 39 | + |
| 40 | +Publish assets manually: |
| 41 | + |
| 42 | +```bash |
| 43 | +php spark assets:publish-bootstrap |
| 44 | +``` |
| 45 | + |
| 46 | +Force overwrite existing files: |
| 47 | + |
| 48 | +```bash |
| 49 | +php spark assets:publish-bootstrap --force |
| 50 | +``` |
| 51 | + |
| 52 | +## Published Files |
| 53 | + |
| 54 | +The package publishes these files: |
| 55 | + |
| 56 | +- `css/bootstrap.min.css` |
| 57 | +- `css/bootstrap.min.css.map` |
| 58 | +- `js/bootstrap.bundle.min.js` |
| 59 | +- `js/bootstrap.bundle.min.js.map` |
| 60 | + |
| 61 | +## Destination |
| 62 | + |
| 63 | +Files are published to: |
| 64 | + |
| 65 | +```text |
| 66 | +public/assets/bootstrap |
| 67 | +``` |
| 68 | + |
| 69 | +## Usage in Views |
| 70 | + |
| 71 | +Example in a CodeIgniter view: |
| 72 | + |
| 73 | +```php |
| 74 | +<link rel="stylesheet" href="<?= base_url('assets/bootstrap/css/bootstrap.min.css') ?>"> |
| 75 | +<script src="<?= base_url('assets/bootstrap/js/bootstrap.bundle.min.js') ?>"></script> |
| 76 | +``` |
| 77 | + |
| 78 | +## Package Structure |
| 79 | + |
| 80 | +```text |
| 81 | +src/ |
| 82 | + Commands/ |
| 83 | + PublishBootstrap.php |
| 84 | + Publishers/ |
| 85 | + BootstrapPublisher.php |
| 86 | +``` |
| 87 | + |
| 88 | +## Local Development |
| 89 | + |
| 90 | +If you want to work on the package locally from another project, you can use a Composer `path` repository. |
| 91 | + |
| 92 | +Example: |
| 93 | + |
| 94 | +```json |
| 95 | +{ |
| 96 | + "repositories": { |
| 97 | + "domprojects-codeigniter4-bootstrap": { |
| 98 | + "type": "path", |
| 99 | + "url": "packages/domprojects/codeigniter4-bootstrap", |
| 100 | + "options": { |
| 101 | + "symlink": false |
| 102 | + } |
| 103 | + } |
| 104 | + } |
| 105 | +} |
| 106 | +``` |
| 107 | + |
| 108 | +If you also test the automation plugin locally, add a second `path` repository for `packages/domprojects/codeigniter4-bootstrap-plugin`. |
| 109 | + |
| 110 | +## Related Package |
| 111 | + |
| 112 | +- `domprojects/codeigniter4-bootstrap-plugin`: optional Composer plugin for automatic publication |
| 113 | + |
| 114 | +## Publish on Packagist |
| 115 | + |
| 116 | +Recommended release flow for this package: |
| 117 | + |
| 118 | +1. Push the repository to GitHub. |
| 119 | +2. Create a tag such as `v1.0.0`. |
| 120 | +3. Submit the GitHub repository URL to Packagist. |
| 121 | + |
| 122 | +If you use the automation plugin, release and publish that repository separately. |
| 123 | + |
| 124 | +## License |
| 125 | + |
| 126 | +MIT |
0 commit comments