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

546
Vistas
How can I serve generated phpDocumentor docs from Laravel?

So I'm using phpDocumentor 3 to generate documentation for my Laravel 7 project,

and was wondering if I could serve this documentation (static files) from Laravel in order to make it available only to authorized users.

I would like to be able to update the documentation through my CI/CD, so I can't just modify manually the generated documentation.

I think that I might have to write my own template (https://docs.phpdoc.org/3.0/guide/guides/templates.html) for that but I'm not sure whether the documentation is incomplete or if I'm missing something because I have no idea how to create a template. Any suggestions, guides or tutorials that can help me achieve this please ?
Thank you

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

0

You can include the phpDoc generation within your CI/CD script:

first install the phpDocumentor on the production, then generate using this command:

phpDocumentor -d . -t storage/docs/ 

Note: the storage path maybe is gitIgnored if you plan to generate the phpDocs, not on the production server, you have to be sure that the folder will be pushed to the production

add this to the config/filesystem.php 'disks':

'local-docs' => [
            'driver' => 'local',
            'root' => storage_path('docs'),
        ],

and add the following in your routes file (routes/web.php)

Route::get('/docs/{url?}', function ($url) {
    $resp = response(Storage::disk('local-docs')->get($url));
    $resp->header('content-type', GuzzleHttp\Psr7\MimeType::fromFilename($url));
    return $resp;

})->where('url', '(.*)')->middleware('auth');

be sure you haven't any other route with the docs prefix

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