Use namespaces, but check the PHP version on the server side and deactivate the plugin with a useful error message if the requirements aren’t met.
If you look at the official statistics, you can see how many installations are still running on outdated WordPress versions. But almost all new plugins require the latest WordPress version, and nobody complains about that. I think there is a large number of abandoned or poorly managed installations out there. They will probably never use your plugin anyway.
That leaves you with a rather small number of installations that are up to date but still on PHP 5.2. They can upgrade. All web hosts offer this nowadays, they couldn’t run Symfony or most other popular scripts otherwise.
The other option is to move the library to a separate plugin and to require that library to be installed first. Then hook into library_loaded
to start your specialized plugin’s code.
Related Posts:
- Should all plugins be encapsulated in a Class?
- Consuming an external API in WordPress?
- How do I extend one plugin I’m writing with another I’m writing using classes?
- Generate custom output for page/URL in a plugin
- Post source link plugin – small modification
- Add CSS animation as Preloader to WordPress
- How to list the Hooks and order of execution in current loading page? [duplicate]
- Setting up widgets in wordpress with a unique ID for the after_title argument
- Modifying Footnote Plugin for Descriptive Title Attributes
- How to Replace Words with Hypertext Link But Ignore Previously Existed Links?
- force customers to add only single item to card per purchase EDD [closed]
- Auto delete WordPress users according to time
- Edit Yoast SEO breadcrumbs output [closed]
- How would I go about creating a user ranked post popularity page?
- How to fetch products with the price in a page on woocommerce using a form or live search with php
- Redirect to another page using contact form 7? [closed]
- Inserting custom PHP script on homepage
- Loop in elementor custom widget not working
- I am trying to make a field show and save from quickedit screen
- .php file for woocommerce edit category? [closed]
- Customize Menu | Styling LESS/SCSS code formats
- Why is it important to check for isset and is_array before checking in_array in this example?
- Comment “like” problem – “users who like this” avatar linking to current user profile instead of “liker’s” profile
- Calling a save function from a “submit” button
- same user role or copy the user role to be same as the other role
- How to fix these PHP Warnings with the “Feed JSON” plug-in?
- woocommerce remove coupon link does not work
- implement custom roles in custom plugin
- Post source link plugin – small modification
- Custom Plugin: How to Include Install Buttons of other 3rd Party Plugins?
- Adding discount functionality to the cart
- How to assign a specific service to a specific provider based on location
- Precheck fields when I add a new post
- Rename a folder via HTML POST request
- Move plugin pages from dashboard to front-end
- working code, not working – Plugin Dev
- Cron job shedules replace?
- Custom shortcode being shown in WPBakery backend rather than the block
- Move plugin upload folder from mywebsite.com/wp-content/uploads/pdfuploads to mywebsite.com/pdfs?
- Woocommerce list variations that are added already to cart in Single Product
- Flexslider empty slide
- Custom SportsPress list
- How to fix vanilla comments extra iframe space
- I want to remove the register/login WordPress top bar from my website
- How to delete remain data in WP database after deleting custom post via admin interface
- What can I do to customize a widget provided with this plugin? from where have I to start?
- WordPress: code structure
- How to make a Template page to show the information of different things Shop and Product page?
- Reposition Woocommerce Message
- Leveraging WordPress Comments on Custom Plugin Object page
- Copyright messages for a particular set of pages
- Sanitizing, Validating and Escaping in WordPress (Plugin)
- Debugging Technique Question re: functions.php
- Get total number of comment of the posts written by an author
- Check if User exists in WordPress Multisite
- How do you remove plugin edit option?
- Is there a way to alter the order in which the plugins appear in the page?
- Getting Post details when post is published
- Escape when echoed
- Scope for PHP Variables Assigned in functions.php or a plugin
- add_meta_box (Will display only in specific page admin WordPress)
- Override the filter from plugin in child theme
- Make specific products accessible only to a user role in WooCommerce
- Undefined property: WP_Post_Type::$ID
- Preventing BFA in WordPress without using a plugin
- Plugin exceeds memory limit
- How to get post URL in the_content filter?
- How to remove xmlns on language_attributes()?
- How to write one comment and publish on every post using database or plugin?
- Add a plugin before main container
- Shortcode to generate and save password in a file
- Custom plugins/Manipulated plugins: Always a terrible idea to inherit these types of WP sites that discourage updates? [closed]
- How to get subscription key or id using Woocommerce Subscriptions [closed]
- How to get member list based on role by using buddypress?
- Delete Associated Media Upon Page / Post Deletion
- I don’t understand how this parameter works..?
- Why wp_mail() function isn’t sending any emails and displaying ‘0’ in Chrome ‘Network’ response
- How to initialize something in unit test before the init hook being called?
- How to check what plugins used to be on a WordPress installation?
- wordpress.org codebase
- Output HTML only on individual post view
- Possible to replicate economist.com’s debate section in wordpress? [closed]
- Can a plugin deactivate and delete itself once installed and activated?
- Missing argument 3 for wp_register_sidebar_widget()
- Make id column as AUTO INCREMENT on plugin activation
- How to Include a Loop Template File in a Plugin
- Write to / remove from default .htaccess file from plugin?
- Manually add order item with fixed product_id in WooCommerce
- FacetWP group listings by custom field [closed]
- Update Option Error: Notice: Undefined index
- How to modify shortcode attributes with data from current post
- How can I display a contact form for out of stock products in WooCommerce?
- ‘Customize’ button in admin bar for CSS
- Pass a php string to a javascript variable
- get shortcode value
- How to get number of Affected rows from wordpress dbDelta() function
- Show price with Geo IP location
- WordPress Ajax Callback
- Add category to body class
- The called constructor method for WP_Widget in GFWidget is deprecated since version 4.3.0! Use