Download the PHP package eloquent/cosmos without Composer

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

Cosmos

A library for representing and manipulating PHP class names.

Build Status Test Coverage

Installation

Available as Composer package eloquent/cosmos.

What is Cosmos?

Cosmos is a library for representing and manipulating PHP class names. It includes a ClassName object, as well as tools to help in resolving class names against a set of namespace and use statements.

ClassName object

This object is designed to represent any valid PHP class or namespace name. There are two ways to create a new ClassName object. From a string or from an array representing the parts of the class name, or 'atoms'. ClassName objects cannot be instatiated directly.

The two methods are demostrated below:

Note the second parameter in the fromAtoms() method. This boolean value determines whether the class name is absolute (starts with a namespace separator).

From here the ClassName object can be used to manipulate the class name or extract information about its constituent parts.

ClassName::atoms()

Returns the parts of the class name as an array of strings.

ClassName::isAbsolute()

Returns boolean true if the class name is absolute (begins with a namespace separator) or boolean false if it does not.

ClassName::isShortName()

Returns boolean true if the class name is not absolute and has only one atom. If either of these conditions is not met, false is returned.

ClassName::isEqualTo(ClassName $className)

Returns boolean true if the supplied class name is exactly equal to this class name. The supplied class name must have identical atoms and match the absolute-ness of this class name.

ClassName::isRuntimeEquivalentTo(ClassName $className)

Returns boolean true if the supplied class name is equivalent to this class name in a runtime context. The supplied class name must have identical atoms but absolute and relative class names are treated identically by PHP at runtime.

ClassName::join(ClassName $className)

Appends $className to the end of this class name and returns the result as a new ClassName object. Note that absolute class names cannot be joined.

ClassName::joinAtoms($atom, ...)

Appends the supplied atoms to the end of this class name and returns the result as a new ClassName object.

ClassName::joinAtomsArray(array $atoms)

Appends the supplied array of atoms to the end of this class name and returns the result as a new ClassName object.

ClassName::hasParent()

Returns boolean true if the class name has a parent namespace, or boolean false if it does not.

ClassName::parent()

Returns the parent namespace of this class name as a new ClassName object.

ClassName::shortName()

Returns the last atom of this class name as a new ClassName object.

ClassName::toAbsolute()

Returns the absolute version of this class name as a ClassName object. If this class name is already absolute, it will simply return itself.

ClassName::toRelative()

Returns the relative version of this class name as a ClassName object. If this class name is already relative, it will simply return itself.

ClassName::hasDescendant(ClassName $className)

Returns boolean true if this class name is one of the parent namespaces of $className or boolean false if it is not.

ClassName::stripNamespace(ClassName $namespaceName)

Strips $namespaceName from this class name and returns the result as a new, ClassName object relative to the supplied namespace name.

ClassName::exists($useAutoload = true)

Returns boolean true if the class name exists. Note that this does not take into account if the class name is absolute or relative. The $useAutoload parameter can be specified to prevent autoloading if necessary.

ClassName::string()

Returns a string representation of this class name. ClassName also implements __toString() which simply returns the result of this method.

Class name resolver

To use the class name resolver, first create a new resolver to represent the set of namespace and use statements to resolve against.

The first parameter represents the namespace statement. It must be supplied as a fully-qualified ClassName object. The second parameter is an array of tuples representing the use statements.

If a 1-tuple is supplied, it represents a use statement without an as clause. A 2-tuple represents a use statement with an attached as clause. The first element of the tuple is always a fully-qualified ClassName object. If present, the second element must be a short ClassName object. That is, one without any namespace separators.

The above resolver is analogous to the following PHP code:

The created resolver can now be used to determine the canonical version of any class name. Note that in the example below, ClassName objects are returned, not plain strings.


All versions of cosmos with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.0
eloquent/equality Version ~2
icecave/isolator Version ~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 eloquent/cosmos contains the following files

Loading the files please wait ....