Download the PHP package loilo/node-path without Composer

On this page you can find all versions of the php package loilo/node-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 node-path

Node.js path Module

Tests Version on packagist.org

This package is a port of Node.js' path module to PHP.

Ported code and docs were created from Node.js v12.8.0.

Install

Usage

Example

Executed on a Unix system (see Windows vs. POSIX):

Windows vs. POSIX

The default operation of this package varies based on the operating system on which your PHP application is running. Specifically, when running on a Windows operating system, it will assume that Windows-style paths are being used.

So using Path::basename() might yield different results on POSIX and Windows:

On POSIX:

On Windows:

To achieve consistent results when working with Windows file paths on any operating system, use Loilo\NodePath\WindowsPath:

On POSIX and Windows:

To achieve consistent results when working with POSIX file paths on any operating system, use Loilo\NodePath\PosixPath:

On POSIX and Windows:

On Windows, this package follows the concept of per-drive working directory. This behavior can be observed when using a drive path without a backslash. For example, Path::resolve('c:\\') can potentially return a different result than Path::resolve('c:'). For more information, see this MSDN page.

API

This is the full API of the PosixPath class.

Note: If not stated otherwise, PathInterface methods are assumed to be executed under a Unix environment.

basename ( string $path [, ext: $suffix ] ) : string

Returns the last portion of $path, similar to the Unix basename command. Trailing directory separators are ignored, see getSeparator().

dirname ( string $path ) : string

Returns the directory name of a path, similar to the Unix dirname command. Trailing directory separators are ignored, see getSeparator().

extname ( string $path ) : string

Returns the extension of the $path, from the last occurrence of the . (period) character to end of string in the last portion of the $path. If there is no . in the last portion of the $path, or if there are no . characters other than the first character of the basename of $path (see basename()) , an empty string is returned.

format ( Loilo\NodePath\PathObjectInterface|array $pathData ) : string

Returns a path string from an associative array or a PathObjectInterface instance. This is the opposite of parse().

When providing properties to the $pathData remember that there are combinations where one property has priority over another:

getDelimiter ( void ) : string

Provides the platform-specific path delimiter:

getSeparator ( void ) : string

Provides the platform-specific path segment separator:

isAbsolute ( string $path ) : bool

Determines if $path is an absolute path.

If the given path is a zero-length string, false will be returned.

join ([ array $... ] ) : string

Joins all given path segments together using the platform-specific separator as a delimiter, then normalizes the resulting path.

Zero-length path segments are ignored. If the joined path string is a zero-length string then '.' will be returned, representing the current working directory.

normalize ( string $path ) : string

Normalizes the given $path, resolving .. and . segments.

When multiple, sequential path segment separation characters are found (e.g. / on POSIX and either \ or / on Windows), they are replaced by a single instance of the platform-specific path segment separator (/ on POSIX and \ on Windows). Trailing separators are preserved.

If the path is a zero-length string, '.' is returned, representing the current working directory.

parse ( string $path ) : Loilo\NodePath\PathObjectInterface

Returns an object whose properties represent significant elements of the path. Trailing directory separators are ignored, see getSeparator().

relative ( string $from, string $to ) : string

Returns the relative path from $from to $to based on the current working directory. If $from and $to each resolve to the same path (after calling resolve() on each), a zero-length string is returned.

If a zero-length string is passed as $from or $to, the current working directory will be used instead of the zero-length strings.

resolve ([ array $... ] ) : string

Resolves a sequence of paths or path segments into an absolute path.

The given sequence of paths is processed from right to left, with each subsequent path prepended until an absolute path is constructed. For instance, given the sequence of path segments: /foo, /bar, baz, calling PathInterface::resolve('/foo', '/bar', 'baz') would return /bar/baz.

If after processing all given path segments an absolute path has not yet been generated, the current working directory is used.

The resulting path is normalized and trailing slashes are removed unless the path is resolved to the root directory.

Zero-length path segments are ignored.

If no path segments are passed, PathInterface::resolve() will return the absolute path of the current working directory.

toNamespacedPath ([ mixed $path = null ] ) : mixed

On Windows systems only, returns an equivalent namespace-prefixed path for the given path. If $path is not a string, it will be returned without modifications.

This method is meaningful only on Windows system. On POSIX systems, the method is non-operational and always returns $path without modifications.


All versions of node-path with dependencies

PHP Build Version
Package Version
Requires php Version >= 7.1
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 loilo/node-path contains the following files

Loading the files please wait ....