Download the PHP package alto/importmap without Composer
On this page you can find all versions of the php package alto/importmap. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package importmap
Alto ImportMap
Alto ImportMap is a PHP library to build, validate, and render import maps in PHP for web applications. It supports imports, scopes and integrity metadata, and includes a resolver aligned with the WICG resolution algorithm.
Installation
Basic Usage
1. Create an ImportMap
You can build an ImportMap manually or by adding entries.
2. Load from File (Optional)
You can also load an existing import map from a JSON file.
3. Render to HTML
Use the HtmlRenderer to generate the <script type="importmap"> tag. It also supports modulepreload links for
performance.
Output:
Advanced Features
Scoped Imports
You can define imports that only apply to specific scopes (paths).
Integrity Hashes
Ensure security by adding integrity hashes (SRI) to your entries. The renderer includes these in the import map. The
Resolver can also use them, and you can access them via the $map->integrity property if needed for other tags.
Merging Maps
You can combine multiple maps, which is useful for modular applications.
Resolving Imports
The NativeResolver implements
the WICG Import Maps resolution algorithm.
This allows you to resolve a specifier to a URL within your PHP application (e.g., for bundling or server-side
rendering).
Documentation
- Installation: install the package and verify its requirements.
- Getting started: build and render a first import map.
- Imports: define and resolve exact, prefix, and scoped imports.
- Packages: load and combine maps contributed by packages.
- Output: generate safe import-map and module-preload tags.
- Caching: cache generated output without hiding map changes.
- Errors: recover from invalid entries, files, and resolutions.
- Complete documentation: review the package scope and every guide.
Contributing
Contributions of all kinds are welcome. Visit the project on GitHub to report a bug, suggest a feature, or open a pull request.
Before submitting code, run:
Changes to public behavior should include tests and documentation.
Support
ALTO ImportMap is open source and independently maintained by Simon André. If it is useful to your work, you can support its continued development through GitHub Sponsors.
Sharing the package or starring it on GitHub also helps.
License
ALTO ImportMap is released by ALTO PHP under the MIT License.