How to Fix Cross Origin Request Blocked in Laravel

Such an error may appear in the browser JavaScript console when the browser blocks API requests because the API is not located on the same domain as your application. If you want to access an API from a different domain, your browser uses the policy for Cross-Origin Resource Sharing (CORS) to determine whether the request … Read more

How to Return Exception as JSON in Laravel

By default, when something throws an exception when accessing an API in Laravel, it is not always returned in a JSON response. A JSON response is returned only when the client explicitly indicates that they want to receive JSON in the response. In all other cases, plain HTML code will be returned, or even a … Read more

How to Use Swagger in Laravel

If you need to interact with a third-party development team or your company wants documentation for an REST APIs you’re developing, you can use the OpenAPI Framework, also called Swagger. It is a standard API documentation system used in many companies. It’s crucial to have standardized, up-to-date documentation so that other developers can easily learn … Read more

How to Create REST API in Laravel

Modern websites are often developed in the SPA (Single Page Application) paradigm, when there is a separate backend written in PHP or another backend language and a frontend developed using one of the popular JavaScript frameworks, such as Vue or React. The backend implements only the API interface that the frontend uses to receive data … Read more

How to Fix 429 Too Many Requests in Laravel

If you make too many requests to the Laravel API, you may see an error with the “429 Too Many Requests” message. By default, Laravel has a limit on the number of requests per minute for all API endpoints. This is done to protect the API from excessive load. However, sometimes it is still necessary … Read more