Like all great services Bunny CDN has an API. Making use theoretically easier. The storage API allows you to upload files, delete files and list files/directories. I’m interested in the listing of files in the storage zone. With the API I can check files have already been uploaded, their size, format and even the date/time they got uploaded.
The default Bunny CDN API returns the uploaded (created) time in ISO 8601 time format, which isn’t compatible with PHP date and time functions. Also returned is the file size as raw bytes not quite as handy to having it in formatted MB and GB.
I addressed these issues in this PHP file. Thanks to a format size units function i got off stack overflow I made a simple function to remove the unnecessary data returned from the API and format it so you can see the simple file name and its extension. Converting the ISO 8601 time stamp into a PHP compatible one makes sorting by upload date easy.
A drained and empty Kennington reservoir images from a drone in early July 2024. The…
Merrimu Reservoir from drone. Click images to view larger.
Using FTP and PHP to get an array of file details such as size and…
Creating and using Laravel form requests to create cleaner code, separation and reusability for your…
Improving the default Laravel login and register views in such a simple manner but making…
Laravel validation for checking if a field value exists in the database. The validation rule…