Download the PHP package ralphjsmit/filesystem without Composer

On this page you can find all versions of the php package ralphjsmit/filesystem. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package filesystem

Stubs Banner

A fluent filesystem package for PHP

This package helps you to speed up the process of moving and copying files. It also makes replacing namespaces much easier, thus making it an invaluable tool for heavy filesystem tasks. Enjoy!

[!IMPORTANT]
This package is only updated until Laravel 10.

⚡️ See the release article on my website or subscribe to my newsletter for an occasional update

Installation

You can install the package via composer:

Usage

This package works by providing you with a base Stub class and a File class. As the name implies, the Stub class is an object that contains specific configuration, like the namespaces and the base directory. The File class is used to represent an individual file.

Creating a Stub configuration

You can create a new Stub configuration with Stub::new():

You can use a Stub configuration like this (I'll talk more about file actions below):

You can also set a base directory for your Stub:

If you already have a $stub instance, you can configure namespaces on them. Those namespaces are used on the File object for the ->namespace() action. It basically means that you define the directories for each namespace in your project.

You can also have multiple stub configurations at the same time:

Getting a File object

You can get a File object by directly calling file() on the Stub class:

You can also get a File object from a $stub instance:

Actions on a File object

If you have a File object, you can perform the following actions on it:

Copying a file

You can copy a file to a new directory using the copy() function:

Deleting a file

You can delete a file using the delete() function:

Getting the basename of a file

You can get the basename of a file using the getBasename() function:

Getting the directory location of a file

You can get the location of the directory of a file using the getDirectory() function:

Getting the full path of a file

You can get the full path of a file using the getFilepath() function:

Getting the file contents

You can get the contents of a file using the getContents() function:

Moving a file

You can move a file to a new directory using the move() function:

Updating the namespace of a file

You may update the namespace of a file and move it to the correct directory with the namespace() helper. This is ideal if you need to move a PHP-file to a new directory and update its namespace. I use this technique in the ralphjsmit/tall-install package.

Checkout a real-life example from one of my packages.

Updating the contents of a file

You may update the contents of a file with the putFile() method:

You may also specify a new location for the file:

If you just want to move or copy a file, you should use those methods.

Updating the namespace of a file

You may replace the namespace of a file with the replaceNamespace($newNamespace) method:

General

🐞 If you spot a bug, please submit a detailed issue, and I'll try to fix it as soon as possible.

🔐 If you discover a vulnerability, please review our security policy.

🙌 If you want to contribute, please submit a pull request. All PRs will be fully credited. If you're unsure whether I'd accept your idea, feel free to contact me!

🙋‍♂️ Ralph J. Smit


All versions of filesystem with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
illuminate/contracts Version ^8.73|^9.0|^10.0
spatie/laravel-package-tools Version ^1.11.0
symfony/finder Version ^5.4|^6.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package ralphjsmit/filesystem contains the following files

Loading the files please wait ....