StrategyGetInstanceByInterfaceInteractor.php ---- class StrategyGetInstanceByInterfaceInteractor { static public function handle($interface_name, $type) { return app()->make(config($interface_name . "." . $type)); } } FruitInterface.php ---- Interface FruitInterface { public function bear(); } config.php ---- return [ 'FruitInterface' => [ 'banana' => '\App\Classes\Fruit\Banana', 'apple' => '\App\Classes\Fruit\Apple', 'grape' => '\App\Classes\Fruit\Grape', ], ]; bad_client.php ---- $fruit_type = $request->get('fruit_type'); switch ($fruit_type) { case 'banana': $fruit = app()->make('\App\Classes\Fruit\Banana'); break; case 'apple': $fruit = app()->make('\App\Classes\Fruit\Apple'); break; case 'grape': $fruit = app()->make('\App\Classes\Fruit\Grape'); break; } $fruit->bear(); good_client.php ---- $fruit_type = $request->get('fruit_type'); $fruit = StrategyGetInstanceByInterfaceInteractor::handle('FruitInterface', $fruit_type); $fruit->bear();