GithubHelp home page GithubHelp logo

isabella232 / php-filesystem Goto Github PK

View Code? Open in Web Editor NEW

This project forked from vube/php-filesystem

0.0 0.0 0.0 273 KB

PHP classes for working with files and the file system

License: MIT License

PHP 100.00%

php-filesystem's Introduction

Vube php-filesystem

Build Status Coverage Status Latest Stable Version Dependency Status

PHP classes for working with files and the file system

Features

  • Safely install files on network mounted drives
  • Atomic file installs; 100% uptime on production systems
  • Atomic symlink modifications; 100% uptime on production systems

Installation

Load php-filesystem into your project by adding the following lines to your composer.json

{
    "require": {
        "vube/php-filesystem": ">=0.1"
    }
}

Example Usage

Install a directory

// Explicitly create a directory.
// ALL parent dirs we create will share mode 0775 as modified by your umask

$installer = new Vube\FileSystem\Installer();
$installer->installDir('/path/to/some/dir', 0775);

Install files safely and atomically

// Install files into /existing-dir
//
// When installing into subdirs, we create all dirs needed,
// the mode is set by your umask.
//
// File installs are network-safe, providing 100% uptime
// on production systems.

$installer = new Vube\FileSystem\Installer();

$installer->installFile('file1', '/existing-dir/file1');
$installer->installFile('file2', '/existing-dir/new-dirs-we-create/with/subdirs/file2');
// Create or overwrite /path/to/symlink
//
// If it already exists, it is atomically updated.

$installer = new Vube\FileSystem\Installer();
$installer->symlink('/path/to/actual', '/path/to/symlink');

Easily diff files

// Compare file1 and file2; are they different?

$differ = new Vube\FileSystem\FileDiffer();

if($differ->isDiff('file1', 'file2'))
    echo "These files are different.\n";

Easily zip files

// Gzip source.txt and save the result in destination.gz

$zipper = new Vube\FileSystem\Gzip();
$zipper->zip('source.txt', 'destination.gz');

Dependencies

  • PHP 5.3.2+
  • Composer

php-filesystem's People

Contributors

ross-p avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.