Support the ongoing development of Laravel.io →
posted 4 years ago
Last updated 2 years ago.
0

I am not sure if I understand.

Make sure the class is autoloaded. If it's in the app or vendor folder it will be. If not you have to add the file to the autoload section of the composer.json.

Once you know that php will be able to locate the file location for the class you can create an inctance with

$className = $json[...];
$instance = new $className;

To send the full class name to your JS you can do get_class($instance)

0

Sign in to participate in this thread!

Eventy

Your banner here too?

Nick nicwek Joined 29 Apr 2020

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.