承接 loilo/storage-paths 相关项目开发

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

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

loilo/storage-paths

Composer 安装命令:

composer require loilo/storage-paths

包简介

Get OS-specific paths for storing your project's config, cache, logs etc.

README 文档

README

Storage Paths logo: a file cabinet with an open drawer which contains printed document

Storage Paths

Tests Version on packagist.org

This package yields OS-specific paths for storing your project's config, cache, logs etc. While the API has been adjusted for PHP, the research and opinionated fallbacks stem from the Node.js env-paths package by Sindre Sorhus.

Install

composer require loilo/storage-paths

Usage

Example for macOS:

use Loilo\StoragePaths\StoragePaths;

$paths = StoragePaths::for('MyApp');

$paths->data()   === '/Users/loilo/Library/Application Support/MyApp-php';
$paths->config() === '/Users/loilo/Library/Preferences/MyApp-php';
$paths->cache()  === '/Users/loilo/Library/Caches/MyApp-php';
$paths->log()    === '/Users/loilo/Library/Logs/MyApp-php';
$paths->temp()   === '/var/folders/qh/z_hny67s57sfm_sxy1zynnkr0000gn/T/MyApp-php';

API

Signature

StoragePaths::for(string $name, array $options): StoragePathsInterface;
  • $name — The name of your project. This is used to generate the paths, therefore it needs to be a valid filename.

  • $options — An (optional) associative array of options:

    • $options['suffix']

      Type: string

      Default: 'php'

      A suffix string appended to the project name to avoid naming conflicts with native apps.

    • $options['os']

      Type: string

      Default: PHP_OS_FAMILY

      Override the operating system to generate paths for. Values correspond to the PHP_OS_FAMILY constant.

Note: Calling StoragePaths::for() only generates the path strings. It doesn't create the directories for you.

Result

The returned StoragePathsInterface provides access to the following storage methods:

  • data() — Directory for data files
  • config() — Directory for config files
  • cache() — Directory for for non-essential data files
  • log() — Directory for log files
  • temp() — Directory for temporary files

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-07-15

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固