Download the PHP package johnbillion/args without Composer

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

Args

Many functions and methods in WordPress accept arguments as an associative array which your IDE or code editor cannot autocomplete like it does for individual function parameters.

This library provides well-documented classes which represent many of the associative array parameters used throughout WordPress. Using them at the point where you populate the arguments means you get autocompletion and intellisense in your code editor, and strict typing thanks to typed properties. Comprehensive types and constraints for PHPStan are also included.

Current status

Last updated for WordPress 6.6.

Requirements

Installation

Changes in version 2

In Args version 2.0 and higher:

Usage

Usage with a class constructor:

Usage with a procedural function parameter:

Meta queries, tax queries, and date queries

The query classes in WordPress support variously meta_query, tax_query, and date_query arguments. These are fully supported and you can construct them in a structured and strongly typed way.

Creating a meta_query argument:

Creating a tax_query argument:

Creating a date_query argument:

Alternatively you can construct a complete query object by calling the fromArray() static method with the same nested array syntax that WordPress core uses:

What's provided

Posts

Taxonomies and terms

Users

Comments

HTTP API

Blocks

Customizer

Everything else

Type checking

Typed class properties are implemented in this library where possible. If you pass a value of the wrong type to an argument that is typed, you'll get a fatal error as long as you're using strict types:

No more mysterious bugs due to incorrect types.

Note that several parameters in WordPress accept multiple types, for example the $ignore_sticky_posts argument for \WP_Query can be a boolean or an integer. In some of these cases I've opted to type the parameter with the most appropriate type even though it can technically accept other types.

Static analysis

PHPStan-specific @phpstan-var tags are used for properties that have a fixed set of values or other constraints. This allows for even greater type and value checking via static analysis with PHPStan.

Ensure you're using a recent version of PHPStan to make the best use of these constraints.

Contributing

Check out CONTRIBUTING.md for information about generating your own Args definitions or contributing to the Args library.

But why?

I have a name for these array-type parameters for passing arguments. I call them Stockholm Parameters. We've gotten so used to using them that we forget what a terrible design pattern it is. This library exists to work around the immediate issue without rearchitecting the whole of WordPress.

Sponsors

The time that I spend maintaining this library and others is in part sponsored by:

Plus all my kind sponsors on GitHub:

Sponsors

Click here to find out about supporting this library and my other WordPress development tools and plugins.

License: GPLv2

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.


All versions of args with dependencies

PHP Build Version
Package Version
Requires php Version >=8.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 johnbillion/args contains the following files

Loading the files please wait ....