Laravel base64 encode Also, unless you specifically need those exact array indexes ( 1 , 2 , 3 ), you can either remove them altogether, or use some more readable names such as message , filename and content . More exactly, you should use “-” instead of “+” and “_” instead of “/”. Ok let’s write more I am trying to save a pdf and other documents file like Docx and video in the database using a base64. 2. Base64 In this article we will learn how to use base64_encode and base64_decode method in PHP Laravel . The preferred way to install this library is to rely on Composer: @catbadger But that's not what this question was about, it was about determining if the data is valid base64, which the string "123412341234" is, just because that's not good enough for your purposes, doesn't mean that it isn't valid base64. This case is generally when you have needed to fetch API x-form data. I have an ajax endpoint that returns a collection. public Intervention\Validation\Rules\Base64::__construct() The field under validation must be Base64 encoded. I have scoured the API Gateway console dashboard for the settings, but to no avail. cvzovtpvlwdznrrxnwffzjkucfpcpmdwspsnhavnekodjjjmsfuamrsxaurotduvphpww