Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

152
Vistas
Where to put custom/new class file in Laravel?

I have PHP example on how to use Yelp Fusion API. It uses OAuth.php file with several classes. In main example it is imported with

require_once('lib/OAuth.php');

Can I do the same in Laravel?

Or I'd better provide namespace for OAuth.php file and put it somewhere on the tree? Where to put it?

over 4 years ago · Santiago Trujillo
2 Respuestas
Responde la pregunta

0

I suggest your to make a new directory inside app and call it like "Classes" and store your OAuth.php as "/app/Classes/OAuth.php". Don't forget to put a namespace App\Classes; to top of this file.

Due to having several classes inside your file I suggest to rewrite this a bit and separate each class to file

over 4 years ago · Santiago Trujillo Denunciar

0

You can use Yelp Fusion API with any other OAuth implementation. Here are OAuth packages for composer: https://packagist.org/search/?q=oauth

Using packages instead of custom PHP files would help to keep project clean.

If you still need to add any custom PHP files just create a directory within /app like "Libraries" or "Helpers" or what fits better to your content.

Directories and files within /app directory loaded automatically by Composer.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda