Composer Autoloader as suggested in the comments is the best way to do it. Just use composers classmap feature:
"autoload": {
"classmap": ["classes/"]
}
Related Posts:
- Authenticating to WordPress, using my own authentication two-factor system
- Why WordPress architecture is not pure object oriented and it don’t use MVC pattern? [closed]
- PHP can I add line numbers to file_get_contents()
- filter default query to show just selected level of child pages in wordpress
- Retrieve $_POST data submitted from external URL in WordPress(NOT API)
- How to obtain the current website URL in my theme?
- What exactly do this function declared into functions.php file of a WP theme?
- Hook called before text widget save
- Custom Registration username_exists / email_exists
- How can I update the price when someone enters postcode or zip code in woocommerce checkout page?
- How to identify which php file a plugin is using on page load?
- WP Custom tables query
- Capture the Selected Radio Button Value between two files in wordpress theme
- Add More Featured Data Not Sending to Database
- Page Reloads Before AJAX Request Finishes
- action hook wp_head higher priority as all other plugins/hooks
- How to create and work with custom data / tables (i.e., for arbitrary data)?
- Change the actual (or viewable) WordPress directory structure
- How do I implement a .diff changeset from core.trac.wordpress.org locally?
- How do I use the Simple HTML DOM Parser in plugin when other plugin already uses it?
- Query String being Removed Creating a Pagination Issue within a Custom Plugin
- Get rewrite slug of custom post type in template
- How to get 2 or multiple custom post types in wordpress functions.php
- Add htaccess rules with insert_with_markers at beginning of htaccess
- custom shortcode will not display the wrapped content
- How to call function at the bottom of post using plugin?
- Multiple choice in a custom taxonomy
- How to restrict wp generate attachment metadata() to certain intermediate image sizes
- wp_insert_post() is returning the correct post ID, no failure, but the post content does not get updated
- Insert array data on plugin activation
- Will simple function names in a class structure conflict with other plugins?
- Do my defines need to be unique?
- Displaying theme options in css
- WordPress php filter admin_body_class not working
- Creating bulk posts with Youtube videos
- Instantiate class to be available to all plugin functions
- Common abstract class for plugins
- Random Default Avatar Function
- Accessing site’s root from themes folder
- Applying OO patterns and principles to plugin development
- How to test nonce with AJAX – Plugin development
- What does $wpdb->get_row return?
- Hide wordpress field if data is empty in post!
- WP add_action factory
- wp_loaded hook block script enquequing
- Custom location for attached images
- Change the site tagline (or similar) based on current page
- Using a `Template Parts` folder instead of an `Includes` folder in a Custom WordPress Theme
- WP nonce invalid
- Trouble creating conditional PHP for nav menu items with children for custom Walker
- woocommerce subscriptions – get expiration date [closed]
- Setting custom canonical urls
- Same log message keeps on printing to debug.log file thousand of times
- Only show search results with if current date is between two dates?
- database interactions using OOP
- Customizer: Output default value in Customizer CSS
- How to add just one specific page to widget without plugin?
- Remove one value in dismissed_wp_pointers?
- Adding Default Settings to Theme My Login plugin
- create a select input with menus created on a custom options page
- Taxonomy linked to pages
- Custom filter in admin edit custom post type responding with invalid post type?
- WordPress Scheduled Event Request Blocking
- How can i upload images in an admin page?
- Append HTML Using Shortcode
- Delete a WordPress transient from a shortcode on Page/Post update
- Plugin CSS not enqueing
- Create onClick Event to Re-load a Widget
- Swapping wp_dropdown_categories function with wp_category_checklist
- Accessing the database from a plugin outside of action hooks
- Adding subdomain to home_url for “add_menu_page”
- Create another “Display Site Title and Tagline” checkbox, “Header Text Color” setting and control
- How to show phpinfo() only in a new tab?
- How to find error in my code when the error message is pointing to WP core file?
- How to select the contents in the text view textrea in wp_editor?
- Accessing data from a non-WP database/table within a page content
- How to customize a permalink (URL) structure?
- WordPress blog post url on category page
- Changing layout with wp_customise
- WP dynamic featured image – Can’t get second featured image url
- Converting HTML Template to WordPress Theme
- Extending the WP_Widget_Text class
- How to Arrange PHP Files to Allow for Multiple Types of Pages?
- How to access global variable $menu inside a class function
- Correct folder permissions?
- Edit Yoast SEO breadcrumbs output [closed]
- Selectbox in admin panel function linking to CSS
- How would I go about creating a user ranked post popularity page?
- Can I install/embed WordPress on a ‘single page’?
- Hide categories that are not used in the post type
- Automated Cart Update With Alert Box Each Time
- How can I remove a function that has been added to wordpress with add_filter?
- PHP Fatal error: Uncaught mysqli_sql_exception: Table doesn’t exist in wordpress/wp-includes/wp-db.php
- WooCommerce/WordPress: how hide entire table form after submit (Admin Dashboard)?
- How to sanitize any integer input field in wordpress?
- How to set up VS Code for WP plugin/theme development in 2021? [closed]
- Connect WordPress with SharePoint [closed]
- WordPress ajax doesn’t display object method on jQuery .change() function
- How to check if a meta value has already been assigned to any user?
- How to hide products that do not have an image from a slider carousel for an ecommerce webpage?