How to Download File from URL in PHP

You may need to get file contents by URL quite often. For example, when you need to import some data from a third-party service, download an image or a backup. There are several ways to download files in PHP. You can use the file_get_contents() function, which stores the contents of any file into a variable, … Read more

How to Get Domain From URL in PHP

Sometimes, you may need to extract the domain or some other parts from an URL. It is a very straightforward task that can be done using the built-in parse_url() function without any external libraries. However, third-party libraries can provide more convenience and power to handle URLs In this short article, I will show how to … Read more

How to Read XLSX File Into Array in PHP

Sometimes you may need to import some data from an XLSX file into your application. The first step is to load the data from the file into an array. There are a few libraries that can help with this task. Each library has its advantages and disadvantages and may be the best solution in a … Read more

How to Install Specific Version of Package Using Composer

Composer is a package manager for the PHP programming language. It allows you to install or update packages, manage their dependencies, and many other things. By default, Composer installs the latest stable version of a selected package. However, you can install any exact version of a package you need. In this short article, I will … Read more

How to Calculate Execution Time in PHP

There are a lot of cases when you might need to measure code execution time. For example, you want to speed up your application and need to find the slowest part or benchmark several approaches to do some task. In this article, I will show you multiple ways to measure execution time in PHP and … Read more

Exit mobile version