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?
- What is right way to go about adding functionality to a published WordPress plugin?
- PHP code on Visual Composer Plugin
- Thumb rating for wordpress – top user
- Errors while using ajax from external wordpress page
- How to add product images using script?
- allow arabic letters when register new account
- Use plugin or custom post type for game score functionality
- Make specific products accessible only to a user role in WooCommerce
- Accessing post’s meta data based on user’s click of a post
- Custom form action to handle data inside a plugin
- WP Post Template – Templates in own folder
- Translating long texts with html formatting
- Shrink down register_settings on Settings API
- custom payment gateway in woocommerce failed to connect to remote api server
- Parse error: syntax error, unexpected ‘new’ (T_NEW) in /misc/41/000/204/381/9/user/web/ragami.net/wp-settings.php on line 219
- Ajax call returning 0
- Some code in shortcode function being ignored
- Anspress Customization: How to show logged in user votes on a single answer?
- Subdomains with almost the same content
- date/time-picker and file upload (image) fields for custom fields (e.g. with more fields)
- Using window.onload with Ubermenu
- What is @Action in WordPress?
- Getting taxonomy images to display on single-post with their terms
- Disable plugin only for one post
- Get all the URLs of the pages that uses a specific shortcode
- Pagination shows Same posts
- Plugin code will not work properly inside a class [closed]
- Theme Functions run a function upon activation or preview
- Custom Module, Extending WP with a Plugin?
- WP Subtitle Plugin Problem
- Custom Plugin scripts from admin working in frontend
- Prevent WordPress from sending set-cookie http header
- Use AJAX to fetch Current Post Thumbnail for WordPress when Uploaded throughMedia Uploader Frontend
- Easiest way to load/fire a handful of functions, IF checkbox is checked?
- Add custom WordPress admin page with pretty url via code
- post id or permalink auto-incrementing number and reset everyday
- How To Use htaccess to Rewrite Link Structure for a Page that is Generated Programatcially
- WordPress logout appends cache/all/index.php to the site_url()
- Custom Icon assigned to menu items not working for multi-site networks
- Change pricing in Woocommerce based on Category and Product [closed]
- WordPress environment not loading properly
- How to remove a css class for any wordpress page
- Place content inside the Post Loop
- Is there any wordpress function to update a random post every 10 minutes?
- custom url with custom post
- MySql Query for WordPress
- show Visual form builder in the front end
- Showing author box on post detail page
- Making a particular kind of search engine with WordPress?
- Custom Slider Per Page created
- is_plugin_active() not defined on active plugin, in the thumbnails.php file
- Requires PHP version 5.3.0