{"id":19030002,"url":"https://github.com/padosoft/io","last_synced_at":"2026-06-20T19:32:16.393Z","repository":{"id":57035026,"uuid":"50192543","full_name":"padosoft/io","owner":"padosoft","description":"Simple agnostic package for IO related (files, dir, etc..)","archived":false,"fork":false,"pushed_at":"2025-08-07T09:48:24.000Z","size":70,"stargazers_count":1,"open_issues_count":2,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-10-12T09:42:14.280Z","etag":null,"topics":["directory","files","filesystem","io","package"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/padosoft.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-01-22T16:20:25.000Z","updated_at":"2022-04-04T22:17:15.000Z","dependencies_parsed_at":"2022-08-23T20:50:46.234Z","dependency_job_id":null,"html_url":"https://github.com/padosoft/io","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/padosoft/io","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/padosoft%2Fio","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/padosoft%2Fio/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/padosoft%2Fio/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/padosoft%2Fio/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/padosoft","download_url":"https://codeload.github.com/padosoft/io/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/padosoft%2Fio/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34583589,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-20T02:00:06.407Z","response_time":98,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["directory","files","filesystem","io","package"],"created_at":"2024-11-08T21:16:05.782Z","updated_at":"2026-06-20T19:32:16.373Z","avatar_url":"https://github.com/padosoft.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Simple agnostic package for IO related (files, dir, etc..)\n\n![Agnostic](https://img.shields.io/badge/php-agnostic-blue.svg?style=flat-square)\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/padosoft/io.svg?style=flat-square)](https://packagist.org/packages/padosoft/io)\n[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE.md)\n[![Build Status](https://img.shields.io/travis/padosoft/io/master.svg?style=flat-square)](https://travis-ci.org/padosoft/io)\n[![Quality Score](https://img.shields.io/scrutinizer/g/padosoft/io.svg?style=flat-square)](https://scrutinizer-ci.com/g/padosoft/io)\n[![Total Downloads](https://img.shields.io/packagist/dt/padosoft/io.svg?style=flat-square)](https://packagist.org/packages/padosoft/io)\n[![SensioLabsInsight](https://img.shields.io/sensiolabs/i/e5f0885a-912d-4bd8-a6c4-76127603d2b6.svg?style=flat-square)](https://insight.sensiolabs.com/projects/e5f0885a-912d-4bd8-a6c4-76127603d2b6)\n\nThis is a simple agnostic package with few or zero dipendencies. \nThis is ideal to provides support and helpers for creating packeges without include many and many dipendencies.\n\n##Requires\n  \n- php: \u003e=7.0.0\n  \n## Installation\n\nYou can install the package via composer:\n``` bash\n$ composer require padosoft/io\n```\n\n## Usage\n\nThen here's an example of how to use `FileHelper` class:\n\nAdd a use statement `use Padosoft\\Io\\FileHelper;`\n\n```php\n\u003c?php\n\nif(FileHelper::checkDirExistOrCreate('public/upload', '0755')){\n    echo 'dir already exists or now created!';\n}else{\n    echo 'OOPS! dir not exists and unable to create it!';\n}\n\n//get all files in public/upload/\n$arrFiles = FileHelper::findFiles('public/upload/*');\nvar_dump($arrFiles);\n\n//get all jpeg in public/upload/\n$arrFiles = FileHelper::findFiles('public/upload/*.jpg');\nvar_dump($arrFiles);\n\n//check if the path ends with slash\nif(DirHelper::endsWithSlash('public/upload')){\n    echo 'add a final slash...';\n    $path = DirHelper::addFinalSlash('public/upload');\n    echo $path;\n}else{\n    echo 'path already finish with slash.';\n}\n\n//get all directories in public/upload/\n$arrFolders = DirHelper::findDirs('public/upload/*');\nvar_dump($arrFolders);\n\n//truncate log to last 2000 bytes without truncate line\necho 'before:'.PHP_EOL;\necho file_get_contents('log.csv');\nif(LogHelper::ftruncatestart('log.csv', 2000)){\n    echo 'after:'.PHP_EOL;\n    echo file_get_contents('log.csv');\n}\n\n```\n\n## List of functions\n\n### DirHelper\n\n- isDirSafe\n- checkDirExistOrCreate\n- addFinalSlash\n- addFinalSlashToAllPaths\n- endsWithSlash\n- endsWithStar\n- endsWith\n- startsWithSlash\n- startsWith\n- findDirs\n- delete\n- removeFinalSlash\n- removeFinalSlashToAllPaths\n- removeStartSlash\n- removeStartSlashToAllPaths\n- copy\n- isLocal\n- isAbsoluteUnix\n- isAbsoluteWindows\n- isAbsoluteWindowsRoot\n- isAbsolute\n- isRelative\n- join\n- njoin\n- canonicalize\n- isDirEmpty : Check if a directory is empty in efficent way. Check hidden files too.\n- isDotDir : Check if an antry is linux dot dir (i.e.: . or .. )\n- isReadable : Check if a path is a dir and is readable.\n\n### FileHelper\n\n- arrMimeType\n- getPathinfoPart\n- getDirname\n- getFilename\n- getFilenameWithoutExtension\n- getFilenameExtension\n- hasExtension\n- variable2Array\n- changeExtension\n- unlinkSafe\n- fileExistsSafe\n- findFiles\n- filePutContentsSafe\n- getMimeType\n- getMimeTypeByFinfo\n- getMimeTypeByMimeContentType\n- isReadable : Check if a path is a file and is readable.\n- filPerms : Gets file or dir permissions in octal form ('0777') or not ('644').\n\n### LogHelper\n\n- ftruncatestart\n\n## Change log\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.\n\n## Testing\n\n``` bash\n$ composer test\n```\n\n## Contributing\n\nPlease see [CONTRIBUTING](CONTRIBUTING.md) for details.\n\n## Security\n\nIf you discover any security related issues, please email instead of using the issue tracker.\n\n## Credits\n- [Lorenzo Padovani](https://github.com/lopadova)\n- [All Contributors](../../contributors)\n\n## About Padosoft\nPadosoft (https://www.padosoft.com) is a software house based in Florence, Italy. Specialized in E-commerce and web sites.\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpadosoft%2Fio","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpadosoft%2Fio","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpadosoft%2Fio/lists"}