Cannot generate ApiDoc assets in Laravel 9 - laravel

I'm new to laravel and I'm having some issues in generating an api documentation (SwaggerAPI, OpenAPI, Postman, whatever it works). I am upgrading a laravel application and got stuck got a few things I need to do solve with the latest version (9.x)
I've followed the steps installing the most popular libraries but I failed getting and error because of lumen is a higher version that is not supported. I also cannot run artistan vendor because it seems not working in Laravel 9 neither.
I've tested the following libraries and they didn't run in Laravel 9:
L5 Swagger
laravel-apidoc-generator
Laravelista and Vendor
Can anyone help me?

Related

Error, Lcobucci\JWT\Signer\InvalidKeyProvided: It was not possible to parse your key

I hope you are doing fine. I was working on Oauth passport laravel, it was working fine on my previouse machine but i had to switch machines.My new machine has php 8 and my laravel project is of 7.30.0 version and my lcobucci/jwt version is 3.3.3. When i try to hit register route on postman i get the following error
Lcobucci\JWT\Signer\InvalidKeyProvided: It was not possible to parse your key, reason: in file C:\Users\user\Documents\GitHub\myproject\vendor\lcobucci\jwt\src\Signer\InvalidKeyProvided.php on line 17
As you can see on https://packagist.org/packages/lcobucci/jwt#3.3.3, that JWT package is officially not compatible with PHP 8. You should upgrade it to a compatible version (at least v4), or downgrade your PHP version to v7
This is coming super late.
For anyone still experiencing this, just generate a new jwt secret.
This command will generate a new key that fits the new requirement
php artisan jwt:secret

How to Build Laravel Production

Currently, I'm using Laravel version 6 and I'm new with Laravel never build production before and I would like to encrypt code also because I don't want to someone understand my code after build

Upgrading Laravel 6 to 7 I have errors with barryvdh/laravel-cors

Upgrading Laravel 6.14.0 to 7 for my laravel backend app
and reading this doc https://laravel.com/docs/7.x/upgrade#upgrade-7.0
I have errors with support of barryvdh/laravel-cors, as I got erorr in console:
Class 'Barryvdh\Cors\ServiceProvider' not found
If to comment 1 line In config/app.php :
// Barryvdh\Cors\ServiceProvider::class,
and reference in app/Http/Kernel.php
I passed console commands(like config cache).
But I got CORS errors in my vue/cli app.
I tried to search in net for Barryvdh\Cors
and seems here https://packagist.org/packages/barryvdh/laravel-cors there is support for laravel 7,
but if installation was changed?
Also I found this https://github.com/fruitcake/laravel-cors package.
Is it replacement of Barryvdh\Cors? Which steps have I to take to run my app as laravel 7?
Thanks!
Yes, Laravel 7 includes first-party support for configuring Cross-Origin Resource Sharing (CORS). It looks like you will have to add the fruitcake/laravel-cors dependency. here is the CORS Support upgrade information from the Laravel documentation.
Yes the vendor name has changed, you can find the upgrade guide here:
Upgrading from 0.x
When upgrading from 0.x versions, there are some breaking changes:
The vendor name has changed (see installation/usage)
Group middleware is no longer supported.
A new 'paths' property is used to enable/disable CORS on certain routes. This is empty by default!
The casing on the props in cors.php has changed from camelCase to snake_case, so if you already have a cors.php file you will
need to update the props in there to match the new casing.
You can find the installation / usage guide here.
PS:
Laravel 5.5 and onward support package auto-discovery so you don't have to add anything into config/app.php anymore.

Laravel 5.2 view in register a provider

i have installed the chat package:
https://github.com/dazzz1er/confer
Unfortunately i get an error when i try to publish it. Here is the error:
[Symfony\Component\Debug\Exception\FatalErrorException]
Call to undefined method Illuminate\Support\Facades\View::composer()
Thanks !
As correctly pointed out by #curious_coder confer is not compatible with Laravel 5.2 yet. Please keep an on the open Laravel 5.2 issue on Github and/or ask the author of this package for updates.

Laravel 5 new declaration causing an error

I am using Laravel 5.0.3 for one project few days ago. Now I create another project using the same version but I noticed the declaration (or whatever you call it) has changed from something like:
'Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode'
to
\Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode::class
and this is actually causing an FatalError. My idea is that this is something to do with the php version, but I don't want to update just yet.
What options do I have to sort this issue?
It's called class name resolution and a new feature that is implemented in PHP 5.5. The reason that you are getting that error is your PHP version of your PHP interpreter should be lower than PHP 5.5. Don't forget that Laravel 5.1 LTS package requires PHP 5.5.9 version minimum. You can keep your old configuration as 'Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode' instead of \Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode::class. But first, you should also downgrade your Laravel version from 5.1 to 5. Better and recommended is to upgrade your PHP version as PHP 5.4 will be soon deprecated.

Resources