承接 plinker/files 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

plinker/files

Composer 安装命令:

composer require plinker/files

包简介

A files component which allows you to read and write files

README 文档

README

A files component which allows you to read and write files.

Install

Require this package with composer using the following command:

$ composer require plinker/files

Client

Creating a client instance is done as follows:

<?php
require 'vendor/autoload.php';

/**
 * Initialize plinker client.
 *
 * @param string $server - URL to server listener.
 * @param string $config - server secret, and/or a additional component data
 */
$client = new \Plinker\Core\Client(
    'http://example.com/server.php',
    [
        'secret' => 'a secret password'
    ]
);

// or using global function
$client = plinker_client('http://example.com/server.php', 'a secret password');

Methods

Once setup, you call the class though its namespace to its method.

List

List files and folders.

Parameter Type Description Default
dir string Base path to list files and folders from ./
extended bool Return extended fileinfo false
depth int Iterator depth 10

Call

$result = $client->files->list('./', false, 10);

Response

Array
(
    [/] => Array
        (
            [0] => Array
                (
                    [name] => server.php
                    [type] => file
                    [size] => 706
                )

            [1] => Array
                (
                    [name] => .plinker
                    [type] => folder
                    [size] => 4096
                )

            [3] => Array
                (
                    [name] => user_classes
                    [type] => folder
                    [size] => 4096
                )

            [5] => Array
                (
                    [name] => demo.php
                    [type] => file
                    [size] => 1628
                )

        )

    [/.plinker] => Array
        (
            [2] => Array
                (
                    [name] => crontab.journal
                    [type] => file
                    [size] => 45
                )

        )

    [/user_classes] => Array
        (
            [4] => Array
                (
                    [name] => demo.php
                    [type] => file
                    [size] => 345
                )

        )

)

Response (with extended true)

Array
(
    [/] => Array
        (
            [0] => Array
                (
                    [name] => server.php
                    [type] => file
                    [size] => 706
                    [info] => Array
                        (
                            [last_access] => 1525369379
                            [change_time] => 1525368118
                            [modified_time] => 1517173011
                            [basename] => server.php
                            [extension] => php
                            [filename] => server.php
                            [group] => 33
                            [owner] => 33
                            [inode] => 3894233
                            [path] => .
                            [pathname] => ./server.php
                            [size] => 706
                            [type] => file
                            [isDir] => 
                            [isExecutable] => 
                            [isFile] => 1
                            [isLink] => 
                            [readable] => 1
                            [writable] => 1
                        )

                )
    // snip..

Create File

Create/Put a file, if file already exists, it will be overwritten.

Parameter Description Default
path File path
contents Contents of the file
flags File operations flags 0

Call

$result = $client->files->put('./path/to/file.txt', 'the file contents');

Response

number of bytes written to file

Get File

Get a file.

Parameter Description Default
path File path

Call

$result = $client->files->get('./path/to/file.txt');

Response

the file contents

Delete File

Delete a file.

Parameter Description Default
path File path

Call

$result = $client->files->delete('./path/to/file.txt');

Response


Testing

There are no tests setup for this component.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please contact me via https://cherone.co.uk instead of using the issue tracker.

Credits

Development Encouragement

If you use this project and make money from it or want to show your appreciation, please feel free to make a donation https://www.paypal.me/lcherone, thanks.

Sponsors

Get your company or name listed throughout the documentation and on each github repository, contact me at https://cherone.co.uk for further details.

License

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

See the organisations page for additional components.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-01-25

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固