Download the PHP package diversified-design/viaphp without Composer

On this page you can find all versions of the php package diversified-design/viaphp. 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 viaphp

ViaPHP

Via is a path alias management library.

It provides a static class for setting shorthand, dot-notation aliases to paths for easy access throughout your codebase, without hardcoding them all and passing around arrays or constants.

Given your project's full root path, and a hostname/IP, Via gives you access to system root, project root and URL root paths.

e.g.:

Paths are sanitized and canonicalized by Symfony's Filesystem component (Path::class), and dot-notation is enabled by

Installation

composer require diversified-design/viaphp

Usage

Setting & Assigning

Note: Internally we use / as the project-relative root path for constructing full filesystem and host paths. This package does not provide methods for handling arbitrary relative paths. All paths returned will always be absolute, based on the project root, local root or hosted root.

Local Path

The absolute local filesystem path of the project, used for absolute filesystem paths.

In real world usage, this would be populated dynamically, based on the system. I.e.: the local system's full path will be different on local development and various deployment systems.

So you would do something like:

You can retrieve the current local path with:

Host Domain

The domain/hostname/IP addreess, for absolute URL paths

Here too, you will want to set this dynamically somehow based on the context.

You can retrieve the current host with:

Set Base

Set Bases

Set mutliple bases at once with an array (Calls self::setBase() internally)

Assign to Base

Assign a sub-path to a Base

Assign to Bases

Assign multiple sub-paths to Bases with an array (Calls self::assignToBase() internally)

Init

Set and Assign a whole config of bases and assignments from a given array. (Calls self::setLocal(), self::setHost(), self::setBases() and self:assignToBases() internally as needed)

Getting

Paths are accessed using dot-notation, and assembled at retrieval time (lazy loaded).

The accessing method is Via::get() but a Via::p() (read: "Via path") forwarder is provided for convenient shorthand notation. ( I use Via::p() myself. )

For even more convenience in templates and view files, a global via() function is also available:

Dynamic Path Appending

Both get(), p(), and the global via() function accept an optional second parameter to append additional path segments:

Global Functions

For ultimate convenience, especially in templates, four global functions are available:

These global functions are automatically available when you include the ViaPHP package via Composer's autoloader.

Path Joining Utility

ViaPHP includes a powerful path joining utility that works independently of the configured path system:

Via::j() Method

The Via::j() method provides arbitrary path joining with cross-platform canonicalization:

Global Function: via_join()

For maximum template convenience, use the global via_join() function:

Key Features:

This utility complements the configured path system by providing flexible arbitrary path joining for dynamic path construction scenarios.


Implemetation Notes

Under the hood we use


Testing

This package uses the Pest PHP testing framework.

Tests are located in ./tests


All versions of viaphp with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
symfony/filesystem Version ^8.0
dflydev/dot-access-data Version ^3.0
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 diversified-design/viaphp contains the following files

Loading the files please wait ...