Why not just check for existence of the Livewire class?
class_exists(\App\Http\Livewire\YourComponent::class)
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I want to check if a livewire component exists before rendering. My program has modules and each client has some of those modules enabled. I can get the list of modules a client has with $client->getModules(). Each module can implement livewire components to enhance functions of the program. I want to render those components if they exist in the correct section of the program. For example in the user creation view, I would have this:
@foreach($client->getModules() as $module) if( component_exists( $module . '::users.create' ) ) @livewire( $module . '::users.create' ) endif; @endforeach If the module implements https://omegle.ws something related to the user creation, it will have the livewire component users.create, but not all modules https://voojio.com/chatroom/omegle will enhance user creation. I need to assert the existence of the component before rendering it. I was wondering if there is something like component_exists( Component::class ), otherwise, I would love to see if someone could give me a hint in how to create it as a helper function.
Please or to participate in this conversation.