https://github.com/wp-plus/composer-autoload
Composer Autoload for WordPress: automagically require the autoload.php generated by Composer (as a must-use plugin).
https://github.com/wp-plus/composer-autoload
autoload composer php wordpress
Last synced: 5 months ago
JSON representation
Composer Autoload for WordPress: automagically require the autoload.php generated by Composer (as a must-use plugin).
- Host: GitHub
- URL: https://github.com/wp-plus/composer-autoload
- Owner: wp-plus
- License: mit
- Created: 2024-04-04T16:52:45.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2025-08-22T07:43:13.000Z (10 months ago)
- Last Synced: 2025-11-04T18:17:25.498Z (8 months ago)
- Topics: autoload, composer, php, wordpress
- Language: PHP
- Homepage:
- Size: 8.79 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Composer Autoload for WordPress
**Seamlessly integrate Composer into a standard WordPress installation.**
This plugin automatically loads Composer’s `vendor/autoload.php` (via an automatically generated **must-use (MU) plugin**), so any Composer-installed libraries are available without modifying WordPress core, themes, plugins or restructuring directories.
**Key features:**
- Drop-in solution for stock WordPress installs
- No changes to `wp-config.php` or core files
- Fully automatic Composer autoloader inclusion
- Works with themes, plugins, or custom PHP libraries managed via Composer
**Usage:**
1. **If Composer is not yet used in the project:**
- Initialize Composer in your WordPress root:
```bash
composer init
```
- Install any libraries you need, e.g.:
```bash
composer require monolog/monolog
```
- Require this plugin:
```bash
composer require wp-plus/composer-autoload
```
- Done - all Composer dependencies, including the newly added ones, are automatically available in WordPress.
2. **If the project is already using Composer:**
- Require this plugin via Composer:
```bash
composer require wp-plus/composer-autoload
```
- Done - your existing Composer dependencies are now autoloaded in WordPress.
- **Optional cleanup:** remove any hardcoded `require 'vendor/autoload.php'` lines from your theme or plugin files, as this plugin handles it automatically.