dnj/filesystem 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

dnj/filesystem

最新稳定版本:1.0.1

Composer 安装命令:

composer require dnj/filesystem

包简介

The Filesystem component provides basic utilities for the filesystem.

README 文档

README

Latest Version on Packagist Total Downloads Software License Testing status

The Filesystem component provides basic utilities for the filesystem and the start point of creating any filesystem

Introduction

This is a repository intended to serve as a starting point if you want to bootstrap a filesystem in PHP.

It could be useful if you want to implement a filesystem. The idea is that you don't have to worry about the basic structure of a filesystem. We Just implement this contracts and have your own filesystem!
We have to

How To Start

First, You should decide what kind of filesystem you decide to create, Like: Local, TMP, S3, FTP or any file system you decide to create. Note: we implement some filesystems that you can use them:
GitHub: All DNJ implemented filesystems

Create new project and require dnj/filesystem , so run:

composer require dnj/filesystem

Then, You should implement two interface, IDirectory and IFile
Note: The above interfaces is extended from See: INode

INode methods:

  • getBasename(): string
  • getDirname(): string
  • getPath(): string
  • getRelativePath(IDirectory $base): string
  • exists(): bool
  • getDirectory(): IDirectory
  • delete(): void
  • rename(string $newName): void

IDirectory methods:

  • files(bool $recursively): Iterator<IFile|IDirectory>
  • items(bool $recursively): Iterator<IFile>
  • directories(bool $recursively): Iterator<IDirectory>
  • make(bool $recursively): void
  • size(bool $recursively): int
  • move(IDirectory $dest): void
  • file(string $name): IFile
  • directory(string $name): IDirectory
  • isEmpty(): bool
  • copyTo(IDirectory $dest): void
  • copyFrom(IDirectory $source): void

IFile methods:

  • copyTo(IFile $dest): void
  • copyFrom(IFile $source): void
  • move(IFile $dest): void
  • read(int $length = 0): string
  • write(string $data): void
  • size(): int
  • getExtension(): string
  • isEmpty(): bool
  • md5(bool $raw): string
  • sha1(bool $raw): string

Helpful resources

We implement some parts of the above interfaces that you can use them:
Directory Abstract: Directory
File Abstract: File
Node Abstract: Node

Example implementation:

Directory:

<?php
namespace YOUR_NAMESPACE\YOUR_FILESYSTEM;

use dnj\Filesystem\Directory as DirectoryAbstract;

class Directory extends DirectoryAbstract
{
    public function make(bool $recursively = true): void
    {
        ...
    }
    .
    .
    .
}

File:

namespace YOUR_NAMESPACE\YOUR_FILESYSTEM;

use dnj\Filesystem\File as FileAbstract;

class Directory extends FileAbstract
{
    public function write(string $data): void
    {
        ...
    }
    public function read(int $length = 0): string
    {
        ...
    }
    .
    .
    .
}

DNJ implemented filesystems:

You can find all implemented filesystems by DNJ by following GitHub

Local FileSystem By DNJ: Github Repository

Temporary FileSystem By DNJ: Github Repository

S3 FileSystem By DNJ: Github Repository

More resources

PHP 8

PHPUnit

About

We'll try to maintain this project as simple as possible, but Pull Requests are welcomed!

License

The MIT License (MIT). Please see License File for more information.

统计信息

  • 总下载量: 1.88k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 7
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-09-26

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固