Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[8.x] Autoload class components #34144

Merged
merged 2 commits into from Sep 4, 2020
Merged

[8.x] Autoload class components #34144

merged 2 commits into from Sep 4, 2020

Conversation

driesvints
Copy link
Member

@driesvints driesvints commented Sep 4, 2020

Use Blade::componentNamespace to register a package namespace with class based components to autoload them. This allows package maintainers to not manually register every component anymore.

For example, a package with a namespace of Package\Components has a class based component at src/Components/FooBar/Baz.php.

Register the component's namespace together with the package name:

Blade::componentNamespace('Package\\Components', 'package');

Usage:

<x-package::foo-bar.baz />

This takes precedence over loading anonymous components: #33954

@GrahamCampbell
Copy link
Member

GrahamCampbell commented Sep 4, 2020

Doesn't this break if two classes in different namespaces have the same name, where as before it worked fine, because the classes were qualified? EDIT: I think I read the code wrong. ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants