Download the PHP package xp-forge/partial without Composer

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

Partials: Compile-time metaprogramming

Build Status on TravisCI XP Framework Module BSD Licence Requires PHP 7.0+ Latest Stable Version

For situations where more logic than just "compiler-assisted copy&paste" using PHP's traits is necessary, this library provides a syntax that expand dynamically based on the containing class at compile time.

Partial flavors

The partials provided by this library's are divided in two flavors: Kinds and composeables.

Regardless of their flavor, some partials are actually implemented by a regular PHP trait, others are dynamically created at runtime. However, the syntax for both is use [Containing-Type]\[is-or-with]\[Partial-Name].

Walk-through

The Box trait creates a value object wrapping around exactly one member. It creates a one-arg constructor, and a value() for retrieving the value, and includes appropriate hashCode(), compareTo() and toString() implementations.

Writing this:

...is equivalent to:

The parametrized Accessors trait creates accessors for all instance members.


Writing this:

...is equivalent to:

If the constructor consists solely of assignments, you can include the Constructor trait and remove it. The parameters will be declared in the order the fields are declared: top to bottom, left to right in the source code.


Writing this:

...is equivalent to:

To combine all these, you can use the Value trait, which a) creates a constructor with all members as parameters, b) accessors for reading these, and c) implements the hashCode(), compareTo() and toString() methods.

The ListOf trait creates a list of elements which can be accessed by their offset, iterated by foreach, and offers equals() and toString() default implementations.


Writing this:

...is equivalent to:

The Builder trait will add a static with() method to your class, generating a fluent interface to create instances. This is especially useful in situation where there are a lot of constructor parameters.

The Comparators trait adds static by[Member] methods returning util.Comparator instances for each member. These instances can be combined using then (Post::byDate()->then(Post::byAuthor())) or reversed (Post::byDate()->reverse()).

The ListIndexedBy trait creates a list of elements which can be queried by name, also overloading iteration and creating equals() and toString() in a sensible manner. The class needs to implement the abstract index method and return a string representing the name.

Putting it all together, we can see the API:

See also


All versions of partial with dependencies

PHP Build Version
Package Version
Requires xp-framework/core Version ^10.0 | ^9.0 | ^8.0 | ^7.0
xp-forge/mirrors Version ^6.0 | ^5.0 | ^4.0 | ^3.0
php Version >=7.0.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 xp-forge/partial contains the following files

Loading the files please wait ....