thiagobarros2/file-counter

A simple way to test how many files are into a given dir based on extension

v1.3.0 2024-02-03 22:27 UTC

This package is auto-updated.

Last update: 2024-06-03 23:32:32 UTC


README

# development
$ composer require thiagobarros2/file-counter --dev

# production
$ composer require thiagobarros2/file-counter

# warning: this package can be of course used in production but was thought to be a dev-dependency

Usage

<?php

namespace src;

use ThiagoBarros\FileCounter\Counter;

function yourFunction() {
    $number_of_files = Counter::number_of_files('path_to_dir', 'file_extension'); //the file_extension param can be provided with or without '.'    
    return $number_of_files;
});

<?php

namespace src;

use ThiagoBarros\FileCounter\Lister;

function yourFunction() {
    $files_by_extension = Lister::files_by_extension('path_to_dir');     
    return $files_by_extension;
});