The answer is — you can’t because WordPress can’t. There is no dependency management concept in WP and it was the same case before Composer had even existed.
The rise of autoload (Composer or otherwise) slightly helps with it, since you might just be getting different copy loaded (hopefully close enough) rather than outright fatal error. You can check for this, if you devise a method to. For example checking the paths the definitions where loaded from with get_included_files()
, but really that’s just a bandaid not a solution.
The only scenario in which Composer really helps you with it is using it to control whole WP installation, with single shared vendor folder.
Related Posts:
- Using composer for dependency management in plugindevelopment
- Autoloading & Namespaces in WordPress Plugins & Themes: Can it Work?
- How can a plugin create a page/form in the front end?
- Looking for WordPress System Diagrams
- How to output message during plugin activation
- On the WordPress Admin section how do I link to submenu pages created for a plugin?
- Why does WordPress have a noop.php file?
- Overwrite theme file from plugin
- Any examples of adding custom fields to the category editor?
- How-to implement admin Ajax inside an admin WP_List_Table?
- What is the etiquette on extending a plug-in
- How to pass a parameter to this add_filter example [duplicate]
- How to get Post ID with the Add Filter Function
- WP 3.3 Tooltips API?
- Clarity needed on usage of multiple 403 forbidden header() functions at the beginning of the plugin files
- Preparing a string in an array for localization
- Cron firing my function everytime wp-admin is visited
- How to Use WordPress Color Picker API in Custom Post Type Metabox
- Formatting of curly brackets array from WP database to get more readable output
- How to find attachment ID for first image in a post
- How to determine wordpress base path when wordpress core is not loaded
- Calling a function from functions.php in custom page/ blog post
- update_option is not working!
- What URL do you pass to wp_remote_get to load the body of the current post’s preview?
- Does WP Have a Function To Generate .htaccess RewriteCond?
- Changing bloginfo description from a plugin
- wp_enqueue_style built in styles
- Override pluggable functions in a plugin?
- WordPress Plugin Setting’s POST
- How do I create a custom api endpoint?
- Add tab to profile.php wordpress plugin development
- Sharing a common set of image files for media library, across all sites within multisite
- wp_localize_script and host/browser cache
- Plugin update not reflected in WordPress plugin page
- Get a custom table to an array
- How do I alter the comment form ‘allowed tags’ text in a plugin?
- Error : “Cannot use object of type WP_Post as array in”
- Replacing Scripts in Admin Load_Scripts
- How to filter content on Save/Publish to add rel=”nofollow” to all external links?
- How to show active version on wordpress.org of a published plugin?
- How to create database table, add data, update and delete using wpdb via plugins?
- Find out Requires WP tag for a plugin when submitting it
- Extending theme PHP class in plugin
- Any ideas to trigger some code after plugin update?
- Plugin Architecture Question: How to avoid using transients
- WP Editor Issue in Backend
- SSL certificate verify failed
- How to test plugin update through WordPress plugin updater without tagging new release in the repo
- How to load library scripts in admin from plugins in noConflict wrapper?
- WP and object persistence (or lack thereof)
- UWooCommerce – add cart discount programmatically?
- Additional classes `undefined` after saving post in Gutenberg
- How do you submit a Gutenberg plugin?
- Bad Request in AJAX
- Remove sidebar on single page using plugin API
- When does save_post hook fire on post save/update
- Enqueuing scripts and styles in custom plugins
- Include file in plugin file
- WP nonce field checkbox prints checked=’checked’ outside input field
- Shortcode not appearing when used as post content in wp_insert_post() or possibly, shortcode not being registered at all
- Creating two tables in database on activation hook
- Adding custom stylesheet into header.php using a plugin
- Developing the save function in Gutenberg blocks
- Detect change in site_url and home_url
- Reporting errors in a shortcode plugin
- Adding Custom CSS with PHP
- How to remove/replace current page template?
- How do I add a menu item to a Pods admin menu?
- Is there a way to add a link with add_post_meta?
- How to receive notification of deprecated API elements and functions?
- Using password protection to load different page elements?
- How to Show Category List With Corresponding Links?
- It is possible to pass $args that sent by add_settings_field() inside another function?
- Change reminder email date to 14 days before
- .htaccess with WordPress – create my own pretty url with parameters (above WordPress settings)
- Generating a password-protected front-end page via a plugin
- How do I add a 5 digit ZIP code validation to a Contact7 form?
- wp_remote_post not working with admin-post.php
- How can we stop showing short code in create or edit post section
- WordPress Own Rewrite Rules
- Default media uploader is not showing in wordpress website
- Delete Plugin Options with Verify
- Don’t print customizer styles when no setting has been used
- Load custom translation in custom plugin fails
- Buddy Press restrict the capability to edit users
- “Headers Already Sent” Nightmare on Plugin
- Uncaught ReferenceError: kpoejy is not defined
- How to get an array out of a nav menu if it’s a plugin?
- Is there better way to do this without duplicating queries?
- How to create a simple plugin which show/hide an html code in wordpress?
- Can I access WordPress API’s from within plugin scripts?
- Is there a way to make is_search() always return false
- How to create custom frontend php page via plugin
- Translation of plugin Upload button
- Apply Filters Causing a 500 Internal Server Error
- Create wordpress dashboard metabox which spans all columns
- add_filter adds output in the head
- How can i add insertion point between inner blocks in my custom block like core blocks
- Update option hook not firing
- Display months on a drop down calendar as TEXT instead of Numbers