Laravel swagger api-docs json file not found - php

Hello i am trying to add swagger into my laravel project.
installed
composer require "darkaonline/l5-swagger:5.6.*"
so when i do
http://127.0.0.1:8000/api/documentation
got info
Fetch error Not Found http://127.0.0.1:8000/docs/api-docs.json
already created docs folder with that json file.
Should i adjust route or change swagger base URL somewhere, not sure whats the problem. Tnx for your help.

You should run the command
php artisan l5-swagger:generate
after adding the annotations

And if you are still getting the Not Found http://your-host/docs/api-docs.json error.
Run chown www-data storage -R

if you still get "Not Found" error after running the
command : php artisan l5-swagger:generate
run
php artisan route:cache , worked for me

open in incognito in chrome or as a private tab in firefox
this problem for your internet explorer, chrome, FireFox

Related

VS Code can not reach Symfony\Component and Symfony\Bundle

I am trying to create a simple symfony project.
I run this on console:
composer create-project symfony/skeleton myProjectName
php -S 127.0.0.1:8000 -t myProjectName/public
Project succesfully run at localhost:8000. However, when I begin to inspect the code, I realized VS Code editor is indicating "Undefined type" error in projectDirectory/src/Kernel.php file. Do you have any ideas why this happens and any suggestions towards solution?
I use PHP v7.4.32 and Symfony 5.4 for development. My helper extentions are PHP Intelephense v1.8.2 and PHP IntelliSense v1.0.11.
projectDirectory/src/Kernel.php
The Error
Since it runs succesfully on browser, I dubted that the classes exist somewhere but the VSCode could not solve the relative paths. Then, I tried a couple of extensions. Installation of PHP v1.22.11089 created by DEVSENSE and PHP Namespace Resolver v1.1.9 created by Mehedi Hassan has solved the problem.

trying to run php artisan tinker returns error "file_exists(): Unable to find the wrapper "hoa" "

I'm trying to open tinker in a Laravel project, but when I run php artisan tinker I get this error:
ErrorException
file_exists(): Unable to find the wrapper "hoa" - did you forget to enable it when you configured PHP?
I can't find everything similar error online, I found only similar errors but with 'wrapper http' .
Does anyone have any suggestions? Thanks
Could this be due to custom code or a library you've imported?
I often find that if I add things to the ServiceProvider or Kernel, they run before many of the artisan commands, and if I've failed to perform the proper "if" checks first, it fails.
I suppose the question I would have in return would be; Is this a fresh Laravel install or have you got custom code and libraries running? I would check there, try removing libraries you've added, HOA from my searching doesn't appear to default to Laravel.
— Happy to revise my answer should more detail be provided
Solved with this command founded on github:
composer require psy/psysh:0.11.2 --dev

How to clear cache automatically on symfony?

I'm trying to create a new route like this:
#Route("/restaurant/", name="restaurant")
#Route("/work/", name="work")
#return Response
But when I visit /work/symfony in my browser, it returns this message:
Unable to parse file "/Applications/XAMPP/xamppfiles/htdocs/apps/symfony/vendor/sensio/framework-extra-bundle/src/DependencyInjection/../Resources/config/annotations.xml": The XML file "/Applications/XAMPP/xamppfiles/htdocs/apps/symfony/vendor/sensio/framework-extra-bundle/src/DependencyInjection/../Resources/config/annotations.xml" is not valid.
When I clear the cache with the following command, it works:
php bin/console cache:clear -v
How can I fix this, without need to clear my cache all the time?
I found the solution by starting a symfony server instead of using XAMPP by running : symfony server:start as simple as that ...

Why does the payload invalid error appears?

enter image description hereenter image description hereI'm getting a payload invalid error for every artisan command:
![][2]
My application was working fine previously without any error, until I ran the app a few days ago on localhost and this error is shown.
You seem to have an old version of the views. Please, run the following commands and try again:
php artisan cache:clear
php artisan view:clear
The payload invalid issue arises when the blades are of different version and the vendor files are of different version.A simple solution is to copy all the content in your current page and then copy it inside a newly created blade with the same version as of the vendor files.

Moved my laravel 5.3 project from a server to other and I got a lot of issues

I just moved my app from a AWS EC2 server to another.
I deploy with GitHub, so, everything should be smooth.
a
But I got a lot of issues:
When I try to login with user / Pass, I get:
TokenMismatchException in VerifyCsrfToken.php line 68:
When I try to login with socialite ( Google / FB ) I get:
Socialite: InvalidStateException in AbstractProvider.php Line 200
I manage a plugin https://github.com/proengsoft/laravel-jsvalidation, that I also give error
Off course, in local, everything works fine ( I use Laravel valet )
I can't figure out what is the common point between all those elements.
What I did :
composer install
php artisan cache:clear
php artisan route:clear
php artisan config:clear
php artian vendor:publish
composer clear-compiled
php artisan migrate -seed
gulp
copied my old .env to the new server ( it's not automatically deployed )
I also checked my storage/framework/sessions folder had write permission.
EDIT: My guess is there is a problem with sessions, but don't really know what... CRSF Field works with session. Also AbstractProvider issue appears to be a session problem. I tried to change session from file to DB, but with no result.
Any idea why is there so many errors?
I read a lot of cases, but none got my solution.
I solved it changing
APP_ENV=testing
to
APP_ENV=test
in my .env file
One more solution to this problem, hope it helps!
Stupid, but very time consuming!!!

Categories