Download the PHP package eloquent/pops without Composer

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

No longer maintained

This package is no longer maintained. See this statement for more info.

Pops

PHP Object Proxy System.

Installation and documentation

What is Pops?

Pops is a system for wrapping PHP objects in other objects to modify their behaviour. A Pops proxy will, as much as possible, imitate the object it wraps. It passes along method calls and returns the underlying result, and allows transparent access to properties (for both setting and getting).

Pops is the underlying system behind Liberator.

Creating proxies

Let's write a simple proxy that converts everything to uppercase. Here we have a class:

And here is our proxy:

We use popsCall() here rather than __call() to get around PHP limitations to do with passing arguments by reference. See [calling methods with by-reference parameters] for a deeper explanation.

Now when we access wat() and $derp both normally, and through our proxy, we can see the effect:

Recursive proxies

Pops proxies can be applied to any value recursively. This comes in handy when designing, for example, an output escaper (similar to Symfony). Here's an example of how such a system could be created for escaping HTML output:

The output escaper can now be used like so:

Which would output:

Note that the above example should NOT be used in production. Output escaping is a complex issue that should not be taken lightly.

Excluding values from recursion

Note that in the above example, the last list item was wrapped in a Safe proxy. When Pops applies its proxies, it will skip anything marked as safe in this manner.

Calling methods with by-reference parameters

Because of PHP limitations, methods with arguments that are passed by reference must be called in a special way.

To explain futher, let's assume our class from before also has a method which accepts a reference:

This method cannot be proxied normally because the $wasPhone argument is passed by reference. The correct way to call the above butWho() method through a Pops proxy looks like this:

Note that there must be a variable for the $wasPhone argument, and there must be a variable for the arguments themselves. Neither can be passed directly as a value. The arguments must also contain a reference to $wasPhone argument.


All versions of pops with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4 || ^8
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/pops contains the following files

Loading the files please wait ....