Download the PHP package karelwintersky/arris.entity.path without Composer

On this page you can find all versions of the php package karelwintersky/arris.entity.path. 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 arris.entity.path

Arris\Entity\Path

Утилитарный класс для построения и манипуляции файловыми путями. Поддерживает как обычные пути файловой системы, так и URL-схемы (https://, ftp:// и т.д.).


Установка

Класс входит в состав пакета arris/entity. Подключается через автозагрузчик Composer:


Быстрый старт


Создание экземпляра

Конструктор

Принимает путь в одном из трёх форматов:

Автоопределение флагов из строки:

Входная строка isAbsolutePath hasTrailingSeparator
/foo/bar true false
foo/bar/ false true
/foo/bar/ true true
foo/bar false/null false
` (пустая) |true|null`

Множественные слэши автоматически схлопываются: foo//bar///bazfoo/bar/baz.

Фабричный метод create()

Эквивалентен конструктору, но удобнее для цепочек вызовов:


Методы

Получение строки

toString(bool $hasTrailingSeparator = false): string

Экспортирует путь в строку. Аргумент позволяет принудительно добавить завершающий разделитель:

Внимание: вызов toString(true) мутирует внутренний флаг $hasTrailingSeparator.

__toString(): string

Псевдоним toString() без аргументов. Позволяет использовать объект в строковом контексте:


Соединение путей

join(mixed $data): Path

Возвращает новый экземпляр с добавленным сегментом. Наследует флаги isAbsolutePath и hasTrailingSeparator из текущего объекта.

joinName(mixed $data): Path

Аналог join(), но принудительно устанавливает hasTrailingSeparator = false. Удобно для добавления имени файла:


Установка флагов

Все методы мутируют текущий объект и возвращают $this для цепочек вызовов.

setAbsolutePath(bool $is_present = true): Path

setTrailingSeparator(bool $is_present = true): Path

setOptions(array $options): Path

Устанавливает сразу несколько флагов. Поддерживает ключи isAbsolute и hasTrailingSeparator:

Неизвестные ключи игнорируются. Значение null также игнорируется (ключ должен присутствовать с непустым значением).


Проверка файловой системы

isPresent(): bool

Возвращает true, если по данному пути существует директория.

isFile(): bool

Возвращает true, если путь указывает на существующий читаемый файл.

makePath(int $access_rights = 0777): bool

Создаёт директорию рекурсивно (аналог mkdir -p). Возвращает true при успехе или если директория уже существует.


Внутренние свойства

Свойство Тип Описание
$atoms array Массив сегментов пути (['var', 'www', 'html'])
$isAbsolutePath ?bool Путь начинается с /
$hasTrailingSeparator ?bool Путь заканчивается на /

Поддержка URL

Класс содержит внутренний механизм («костыль») для работы с URL-схемами: :// при разборе заменяется на :||, а при экспорте возвращается обратно. Это позволяет использовать Path для сборки URL, хотя для полноценной работы с URL рекомендуется использовать специализированный класс.


Совместимость и требования


Известные особенности поведения


Лицензия

MIT


All versions of arris.entity.path with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
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 karelwintersky/arris.entity.path contains the following files

Loading the files please wait ...