Download the PHP package imran/file without Composer
On this page you can find all versions of the php package imran/file. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package file
File Handling
The File
class is a PHP class that provides a convenient and easy-to-use API for working with files and directories in PHP. With this class, you can perform a wide range of file-related operations, such as reading and writing to files, creating and deleting directories, moving and copying files, and more.
All the methods in this class are static methods, meaning that you can use them without creating an instance of the class. This makes it easy to use the class from anywhere in your code.
Overall, the File class provides a powerful and user-friendly API for working with files and directories in PHP. Whether you're a beginner or an experienced PHP developer, this class is a valuable tool for simplifying file-related tasks and improving the reliability and performance of your code.
Features
exists
: Check if a file or directory existsget
: Get the contents of a fileput
: Put contents into a fileappend
: Append contents to a filedelete
: Delete a fileisDirectory
: Check if a path is a directorymakeDirectory
: Create a directorydeleteDirectory
: Delete a directoryreadDirectory
: Read the contents of a directorychangeMode
: Change the mode of a file or directoryprepend
: Prepend contents to a filelink
: Create a symbolic link to a target filename
: Get the file name without extensionbaseName
: Get the base name of a filedirName
: Get the directory name of a filetype
: Get the type of fileisReadable
: Check if a file is readableisWriteable
: Check if a file is writeableisFile
: Check if a path is a filefiles
: Get all files in a directoryallFiles
: Get all files in a directory and its subdirectoriesmoveDirectory
: Move a directory to a new locationcopyDirectory
: Copy a directory to a new locationcleanDirectories
: Delete all files in a directorysize
: Get the size of a file in byteslastModified
: Get the last modification time of a file as a UNIXcopy
: Copies a file from one location to anothermove
: Moves a file from one location to anotherextension
: Get extension of a filemimeType
: Get the MIME type of file
Requirements
- PHP 8.0 or Higher
- PHP File info Extension:
ext-fileinfo
Installation
First, include the File.php class in your project.
or by using composer Recommended way
Methods
exists
The exists()
method checks if a file or directory exists.
get
The get()
method gets the contents of a file.
put
The put()
method puts contents into a file.
append
The append()
method appends contents to a file.
delete
The delete()
method deletes a file.
isDirectory
The isDirectory()
method checks if a path is a directory.
makeDirectory
The makeDirectory()
method creates a directory.
deleteDirectory
The deleteDirectory()
method deletes a directory.
readDirectory
The readDirectory()
method reads the contents of a directory.
changeMode
The changeMode()
method changes the mode of a file or directory.
prepend
The prepend()
method prepends contents to a file.
move
The move()
method moves a file to a new location.
link
The link()
method creates a symbolic link to a target file.
name
The name()
method gets the file name without extension.
basename
The basename()
method gets the base name of a file.
dirname
The dirname()
method gets the directory name of a file.
type
The type()
method gets the type of file.
isReadable
The isReadable()
method checks if a file is readable.
isWriteable
The isWriteable()
method checks if a file is writeable.
isFile
The isFile()
method checks if a path is a file.
files
The files()
method gets all files in a directory.
allFiles
The allFiles()
method gets all files in a directory and its subdirectories.
moveDirectory
The moveDirectory()
method moves a directory to a new location.
copyDirectory
The copyDirectory()
method copies a directory to a new location.
cleanDirectory
The cleanDirectory()
method deletes all files in a directory.
size
The size()
method returns the size of a file in bytes.
lastModified
The lastModified()
method returns the last modification time of a file as a UNIX timestamp.
copy
The copy()
method copies a file from one location to another.
move
The move()
method moves a file from one location to another.
extension
The extension()
method returns the extension of a file.
mimeType
The mimeType()
method returns the MIME type of file.
Running Tests
To run tests, use following command
Hi, I'm Imran Ali! 👋
🚀 About Me
Senior Full-Stack Developer specializing in front end and back-end development. Experienced with all stages of the development cycle for dynamic web projects. Innovative, creative and a proven team player, I possess a Tech Degree in Front End Development and have 7 years building developing and managing websites, applications and programs for various companies. I seek to secure the position of Senior Full Stack Developer where i can share my skills, expertise and experience with valuable clients.
🛠 Skills
PHP OOP, Laravel, Codeigniter Javascript, Node, React, Vue, Git, HTML, Rest Api, Typescript, Angular, SCSS, Docker, CI/CD Jenkins, Bootstrap, Responsive Design, ASP.NET Core
🔗 Follow on
License
Contributing
Contributions are always welcome!
See contributing.md
for ways to get started.
Please adhere to this project's code of conduct
.
All versions of file with dependencies
ext-fileinfo Version *