PHP Classes

How to Implement a Laravel JSON API that Only Allows Clients that Request JSON Responses - Laravel JSON Request Validation package blog

Recommend this page to a friend!
  All package blogs All package blogs   Laravel JSON Request Validation Laravel JSON Request Validation   Blog Laravel JSON Request Validation package blog   RSS 1.0 feed RSS 2.0 feed   Blog How to Implement a La...  
  Post a comment Post a comment   See comments See comments (0)   Trackbacks (0)  

Author:

Updated on: 2021-03-15

Posted on: 2021-03-15

Package: Laravel JSON Request Validation

There are certain types of applications, like for instance APIs, that only serve data values as responses.

JSON is nowadays a common format to serve HTTP responses with data values represented as text.

When an API application is only meant to serve JSON based responses, it is useful to refuse serving requests from clients that are not ready to take JSON based responses, like for instance requests from regular browsers that expect HTML pages.

This package provides a solution that can be used in Laravel based applications to refuse serving HTTP requests from clients that are not ready to handle JSON based responses.




Loaded Article

About the Laravel JSON Request Validation Package

The package Laravel JSON Request Validation is one of the few PHP packages that was considered notable recently because it does something that is worth paying attention.

The basic purpose is: Disallow HTTP requests that do not accept JSON

Here follows in more detail what it does:

This class is a middleware that can disallow HTTP requests that do not accept JSON.

It checks the current HTTP request to check the values for the Accept header.

The class will return HTTP status 400 if the application/json MIME type is not in the headers that the client accepts.

Conclusion

The Laravel JSON Request Validation can be downloaded from download page or be installed using the PHP Composer tool following instructions in the Composer install instructions page.

This package was considered notable for implementing its benefits in a way that is worth noticing.

Notable PHP packages can be often considered innovative. If this package is also innovative, it can be nominated to the PHP Innovation Award and the author may win prizes and recognition for sharing innovative packages.

If you also developed your own notable or innovative packages consider sharing them, so you can also earn more visibility for your package as well nice prizes.

One nice prize that many PHP developers want and you may like is the PHP elePHPant mascot plush.




You need to be a registered user or login to post a comment

1,592,439 PHP developers registered to the PHP Classes site.
Be One of Us!

Login Immediately with your account on:

FacebookGmail
HotmailStackOverflow
GitHubYahoo


Comments:

No comments were submitted yet.



  Post a comment Post a comment   See comments See comments (0)   Trackbacks (0)  
  All package blogs All package blogs   Laravel JSON Request Validation Laravel JSON Request Validation   Blog Laravel JSON Request Validation package blog   RSS 1.0 feed RSS 2.0 feed   Blog How to Implement a La...  
For more information send a message to info at phpclasses dot org.