This image gallery was developed using only PHP in the beckend, it is not necessary to use a database. As for the frontend, it was developed using only HTML, CSS and JavaScript.
This is possible thanks to the FilesystemIterator class, this class is native to PHP and it returns a list of files and folders that are inside the directory informed in its constructor. Note: this instance of FilesystemIterator, as its name suggests, is iterable as an array, that is, it can be used directly in a repetition structure such as for (), foreach () and etc.. See the example:
<?php
$files = new FilesystemIterator(
__DIR__.'/public/assets/img'
);
foreach($files as $file){
echo $file
->getFilename().PHP_EOL;
}
folder-2741806_1280.png
gallery
icons
screenshot
top_directory.png
wall-2558279_1920.jpg
git clone https://github.com/marvinoliveiras/image-gallery-without-database
composer install
php -s localhost: 80 -t public
- Public home:
http://localhost
- Admin home:
http://localhost/admin
- PHP 7 or above;
- phpunit / phpunit;
- PSR4 (Symfony autoload);
- MIT