Download the PHP package demos-europe/edt-paths without Composer

On this page you can find all versions of the php package demos-europe/edt-paths. 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 edt-paths

Tools to create paths between entities and entity properties.

Provides PHP classes to enable you to use phpdoc tags to annotate classes as path segment and reference other path segments to define a directed graph, which can be used to build property paths for conditions and sort methods with IDE support.

== Overview

This component enables you to mark classes as path segment and reference such classes in other classes as relationships.

To give an example suppose we have a class Comment with a relationship to the class Article which in turn has a relationship to the class Author. If we want to build a path using the property names of the relationships we could define an array like the following manually: ['article', 'author']. For this you not only have to know the property names at the time you write the path but also need to adjust all paths using a property when the name of the property changes.

An alternative would be to define string constants in each class with the names of each property. In this case you could do something like this [Comment::ARTICLE, Article::AUTHOR]. This way you can change the value of the constant without adjusting each path manually. Also, your IDE can help you find each usage of a property in your application.

This component extends on these advantages and uses phpdoc @property-read tags instead of constants. As a result you can define the path with the following expression: $comment->article->author->getAsNames(). The result will be the same as in the examples above. This way your IDE provides you with a list of available relationships at each segment and can keep track of the usage of each @property-read, allowing for easy property renaming.

To enable a class as path segment and add working @property-read tags you only need to add the PropertyAutoPathTrait as use inside your class. After that you can add @property-read tags with the type of the target class as shown below for the Article class.

[source,php]

/**

By default, the constructor of your class will be ignored and a not fully initialized instance will be returned. This means that you may not be able to use the instances resulting from a path for anything else but further path building. So the above class will work for $comment->article->authors->getAsNames() but will fail for $comment->article->getText().

However, if you pass a factory callback to the trait the path segments will be created using that callback, resulting in fully usable instances of your class. Such factory will depend on your system architecture. The following example can only give a rough idea, your solution may differ.

[source,php]

/**

Note that this example will fall back to the not fully initialized instances in case of to-many relationships. This is the case because it would otherwise need to select an Article instance in case of paths like $author->articles. Such paths can still be used for further path building like $author->articles->comments->getAsNames(). But like mentioned before it may fail if methods of the actual class are used, like in the following access: $author->articles->getText(). This is a known limitation considered acceptable, as the main usage is the building of paths, not a replacement of getters to fetch actual instances.

== Supported tags

The example above uses the property-read tag to add properties to your path class. This is the default as it seems to make the most sense for the path building use case, however you can change it to other tags if desired as shown below.

[source,php]

/**

You can set multiple tags too, as is shown below for the property-read and property tags.

[source,php]

/**

Supported tags are:

== Credits and acknowledgements

Conception and implementation by Christian Dressler with many thanks to https://github.com/eFrane[eFrane].


All versions of edt-paths with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
phpdocumentor/reflection-docblock Version ^5.1.0
demos-europe/edt-queries Version ^0.25.1
nikic/php-parser Version ^4.14 || ^5
thecodingmachine/safe Version ^2.4.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 demos-europe/edt-paths contains the following files

Loading the files please wait ....