PHPackages                             nickolasburr/ezimports - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. nickolasburr/ezimports

AbandonedArchivedLibrary[Utility &amp; Helpers](/categories/utility)

nickolasburr/ezimports
======================

Register PHP imports at runtime.

27PHP

Since Feb 27Pushed 6y ago1 watchersCompare

[ Source](https://github.com/nickolasburr/ezimports)[ Packagist](https://packagist.org/packages/nickolasburr/ezimports)[ RSS](/packages/nickolasburr-ezimports/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

ezimports
=========

[](#ezimports)

Register PHP imports via JSON.

Table of Contents
-----------------

[](#table-of-contents)

- [Installation](#installation)
- [Configuration](#configuration)
- [Constants](#constants)
- [Usage](#usage)
- [Benefits](#benefits)
- [Caveats](#caveats)

Installation
------------

[](#installation)

```
composer require nickolasburr/ezimports

```

Configuration
-------------

[](#configuration)

The imports JSON file should contain an array of objects, each representing an entity and its subsequent imports. For each entity object, the following properties should be specified:

- `class`: The FQCN of the class, interface, or trait.
- `imports`: An array of import objects.
    - `use`: The FQCN of the class, interface, or trait to import.
    - `as`: \[OPTIONAL\] The alias to use in place of the short name. Defaults to short name.

Constants
---------

[](#constants)

Prior to searching, ezimports looks for the following constants:

- `EZIMPORTS_MODULE_PATH`: The path to the ezimports module directory. Defaults to `vendor/nickolasburr/ezimports`.
- `__IMPORTS_FILE_NAME`: Imports file basename. Defaults to `imports.json`.
- `__IMPORTS_FILE_PATH`: Imports file path. Defaults to `vendor///imports.json`.

Usage
-----

[](#usage)

Instead of including imports statically:

```
