You are overthinking this. The namespace structure applies at the level of individual package. There is no need or push to treat the whole site as such package.
Also one of the benefits of using autoload in first place is that it makes location of classes in file system largely irrelevant.
So the simple and practical approach is to:
- Handle namespaces at individual package (plugin/theme) level.
- Use PSR-4 support in Composer for simple directory structure inside packages, without excessive folder levels.
Related Posts:
- Why include a composer.json file with my plugin?
- Autoloading in Child Theme
- Customize default settings on new sites on multisite
- Does wordpress allow me to add a php file to the root directory to execute custom scripts?
- Use composer to load custom classes [closed]
- What’s the proper way to use wp_enqueue_script/style?
- How to send user data in json format to another server when user register on wordpress site in PHP
- Change the actual (or viewable) WordPress directory structure
- Accessing site’s root from themes folder
- Custom location for attached images
- Using a `Template Parts` folder instead of an `Includes` folder in a Custom WordPress Theme
- Using WordPress gettext functions in a library outside plugin or theme scope
- How to Arrange PHP Files to Allow for Multiple Types of Pages?
- Correct folder permissions?
- subdirectory index.php is not working
- Accessing an image folder inside public web directory
- Noscript not working as it should in wordpress site
- Code Executing Too Late?
- PHP in CSS file?
- Plugin development and composer
- How can I search all plugins for composer’s vendor/autoload.php?
- Composer setup-config.php not found
- Using the get_template_part method within an mu-plugin not possible?
- New user – Create a folder
- Autoloading Classes in Plugins
- How to override html codes in wordpress?
- How do I prevent a folder from reappearing in my home directory?
- Resource 404 error on multisite subdirectory install
- Changes in header.php not reflecting
- Removing get_template_part in child theme
- Permission functions within wordpress
- WP white screen of death after duping a site that works fine on same server
- Correct Syntax for uploading files to custom directory in WordPress
- Can I have a php site on subdirectory of WordPress?
- How to add a php package to an existing wordpress website
- Get a list of folders inside uploads directory
- How to update custom fields using the wp_insert_post() function?
- WordPress PHP version requirements
- Removing Default Gutenberg Blocks, But Keeping Reusable Block Functionality?
- Uninstalling a plugin: delete all options with specific prefix
- How to add some custom HTML to the edit posts page
- Add Useragent to the body class?
- How to get the list of WooCommerce product image of a certain category from database?
- How to override an unpluggable parent theme function?
- What would be a PHP command to erase all posts from category X from the last month?
- How to insert PHP code in a WordPress Post
- Change comments form title on a page by page basis
- Load custom field value into div with AJAX
- Creating wordpress user registration form
- How to reduce the database query-es
- Get the title before comma
- Accessing a random image via ajax
- wp enqueue style and style sheet depth
- “Can’t use function return value in write context” error
- Display 4 chronological posts starting with a random post
- Displaying Only Certain Tags in Loop
- Duplicates with WP_Query loop
- my function doesn’t return my post from today
- “Notice: Undefined variable: content” is showing [closed]
- Customized title tag for each page in pagination?
- How should I best target dynamically served content?
- WordPress automatically adds tags when pasting code, how to stop it?
- ACF: Only get first row of a Repeater Field
- using add_action for a header hook that has an additional parameter
- Template part inside shortcode, unexpected reult
- How to enqueue CSS and JS only on specific template?
- get_the_terms – only top level
- Have CSS Class Added with `is_page()` WP function
- Slide in Panel WordPress Post
- Shortcode Inside Class Not Working
- Category Thumbnail Display – How to display ONLY the main Category
- Woocommerce add to cart quantity buttons with AJAX
- How can I use wp_query to show all product data using just the products ID?
- WP add_action factory
- how to retrieve uploaded url of zip files
- save imported posts as drafts
- How to show phpinfo() only in a new tab?
- RecursiveDirectoryIterator not working in admin
- Call global variable array() in woocommerce child/template
- My form action url is being prepended with a directory that does not exists
- Getting id of poll from WP database
- PHP WordPress optimization my loop code
- custom fields wordpress
- Ajax load more posts with multiple tax query
- Ajax call not working
- WordPress Sending data to Ajax with select option
- Get value from shortcode to do something
- SQL Injection blocked by firewall
- PHP 8, AJAX mail form to function.php doesn’t work
- Auto-Select Parent Category as Primary
- Changes in permalink structure in WordPress and how to apply to in-site links
- How can I pass a custom/dynamic product to the Woocommerce cart?
- Long running queries
- How to create global title in header of wordpress theme
- WP Cron job timeout issues
- comments sorting incorrectly across multiple pages
- auto-populating custom nav with all items from custom post type
- Can’t find infinite loop cause
- how to make custom ajax handler?
- Irregular TTFB and server wait time response