Download the PHP package deviscoding/code-objects without Composer

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

Code Objects

PHP Library which includes classes for the resolution of class names and callables, as well as the manipulation of code construct strings such as class names, method names, CSS classes, HTML5 ids, table names, and more.

Using this library? I'd love to hear about it! Star the repo, or mention @jonesiscoding in a tweet!

Version Objects

There are two version objects designed for parsing and comparing Semantic Version numbers, Version and VersionImmutable.

Construct Objects

There are three main construct objects: ConstructString, ClassString and MethodString. Both ClassString and MethodString are extensions of ConstructString.

The base ConstructString class to work with the name of any coding construct such as a table, class, method, key, etc.

The more specific ClassString and MethodString contain additional methods for dealing with situations specific to a method name or a class name such as extracting the class name, the namespace, the function name, etc.

Common Methods

Method Purpose
css Sanitizes a string for use as a CSS class, or HTML5 id.
camelize Changes _classname to className (camelCase)
classify Changes _classname to ClassName (PascalCase)
slugify Removes all special characters and replaced spacers with dashes or the provided separator
snakeize Changes ClassName to _classname (snake_case)

Resolver Classes

The resolver classes are aimed at allowing for the resolution of PHP classes and callables. At most times during development, the use of autoloaders and PSR-0 or PSR-4 structure would prevent the need for the resolution of classes and callables.

These classes can be useful, however, in situations where callables are configured outside your code base, such as in a YAML or XML configuration file or in a database. Often in these situations, callables and classes are referred to with a key or id, rather than the fully qualified class name

Another situation in which these classes can be useful is when you have multiple classes that could be used, and these classes exist in multiple name spaces. For example, when some classes that implement a specific interface are part of your code base, but others may be part of a vendor library.

Each class contains one main method: resolve, which will resolve the given string, array, or object.

Class Resolver

At instantiation, this class is provided a namespace or "sibling" class (from which to derive a namespace). An array of namespaces or sibling classes may also be provided.

When the resolve method is called, it resolves the provided string into a fully qualified class name by matching to existing classes within the namespaces provided to the resolver at instantiation.

Implementation Resolver

This class functions the same as the ClassResolver, but only resolves classes that implement the interface given at the time of instantiation.

Callback Resolver

The CallbackResolver class is also provided a namespace or "sibling" class at instantiation, and will also take an array of namespaces or sibling classes.

When the resolve method is called, it resolves the provided string, array, or object into a \Closure by first resolving any class as needed, instantiating and needed object (if possible), verifying that the requested method is callable, then converting the callable into a \Closure.

The item to resolve may be in any of these formats:

These may also be provided. Though they would need no resolution, they would be validated to be callable and turned into a \Closure.

ContainerAwareCallbackResolver

The ContainerAwareCallbackResolver must be provided a PSR-11 Container Interface at instantiation, and may also be provided optional namespaces or "sibling" classes at instantiation. The ContainerInterface object is used as a dependency injection service locator, for example, the container used in the Symfony framework.

When the resolve method is called, this resolver type will attempt to match the class portion of any item to an id of a service in the ContainerInterface, then proceed with resolving the rest of the callback.

Closure

The Closure class is a super-charged drop-in replacement for PHP 7.1's \Closure::fromCallable, and works using a method of the same name. This class is not intended for separate use, but instead does the "heavy lifting" for the CallbackResolver, taking either an array or a string that should be callable, instantiates any class into an object (if necessary and possible), then creates a closure from the resulting callable.

In PHP 7.1+, the original \Closure::fromCallable is used for the final step. In previous versions, the resulting \Closure is created "the old fashioned way"


All versions of code-objects with dependencies

PHP Build Version
Package Version
Requires php Version >=7.0
ext-json Version *
psr/container Version ^1.0|^2.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 deviscoding/code-objects contains the following files

Loading the files please wait ....