If you are working in Laravel, you might have noticed that majority of the developers save sensitive information like database credentials, SMTP settings and API keys in the .env file. This file exists at the root level of your project. I was also saving my credentials in .env files for a long time until I …
Read More “Do not use .env to store sensitive credentials in Laravel”
Getting file extension from file name or path can be done in Javascript and PHP. I will show you the steps to get the file extension and you can apply them in any language you want. Following code will get the file extension from file name or file path in Javascript: Your parts variable will …
Read More “Get file extension from name – Javascript, PHP”
Suppose you are creating a tab layout where there are multiple tabs and each tab has its own content. You click on the tab button and its content is displayed. But when you refresh the page, it starts from the first tab again. How can you make so that when you refresh the page, it …
Read More “Highlight current tab after page refresh – HTML, Javascript, PHP”
In order to get an authentication user without using sanctum middleware in Laravel, you just need to pass the string “sanctum” in auth() method. Auth sanctum without middleware Following route goes in the “routes/api.php” file: Auth sanctum with middleware If you do not want to use the “sanctum” string in auth() method, then you need …
Read More “Get auth user without sanctum middleware – Laravel”
A file manager web app is created in Laravel and React JS. We offer free 10 MB storage so you can test this script. Test it before you buy it. Easy deployment, you can just buy and upload the files on your server. Further instructions for deployment are in the file “README.md”. Check our tutorial …
Read More “File Manager in Laravel and React JS”
Previously, I wrote an article on how to compress images in Node JS. In this article, we will discuss how you can compress an image in PHP. Let’s say you have an image named “image.png”. The following code will compress the file by half: Explanation: Why use JPEG for compressed image You might be wondering …
Read More “How to compress image in PHP”
In this article, we will teach you, how you can get user location in PHP. We have a users table where we are saving the user’s location and the time when the last location was fetched. The most important columns are “location” and “last_location_at”. We will be fetching the user’s location every 24 hours. The …
Read More “Get user location in PHP”
If you keep getting 403 forbidden error on your Laravel storage files and you want to know how to fix this, you have landed on the right site. 403 forbidden error is typically when you do not have enough permission to read a file and it happens mostly on live servers (on production). I was …
Read More “How to fix Laravel 403 forbidden storage error”
If you are developing an application in PHP or any of its frameworks (e.g. Laravel) where you are allowing users to upload videos, and you want to get the duration of the video then this article is for you. Getting the duration of user uploaded video has many benefits. One of them is you can …
Read More “Get duration of video in PHP”
If you are working in Laravel and want to get the size of uploaded file, you have come to the right place. Let’s say you are developing an application where it is required to see the total file size uploaded by user. In this case, you need to keep track of all the uploaded files. …
Read More “Get uploaded file size in Laravel 11”