Download the PHP package dxw/php-missing without Composer

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

php-missing

PHP's standard library contains a lot of stuff, but it's missing a lot of stuff. All these functions are basic things that I've had to implement over and over again.

Installation

Install composer.

Run the following in the root of your project:

composer require dxw/php-missing

Or, create a composer.json file with the following contents and run "composer install":

{
  "require": {
    "dxw/php-missing": "^2.0"
  }
}

API

Arrays

$array = \Missing\Arrays::flatten($array)

Flattens an array containing arrays.

\Missing\Arrays::flatten([1, [2, 3, [4, 5]]]) === [1, 2, 3, 4, 5]

$array = \Missing\Arrays::sortBy($array, $callback)

Sorts $array by $callback($array_element).

\Missing\Arrays::sortBy(['abc', 'ab', 'a'], function ($a) {return strlen($a);}) === ['a', 'ab', 'abc']

Dates

list($timestamp, $err) = \Missing\Dates::parse($str)

Parses several common/standard time formats, returns a Dxw\Result\Result object containing either the UNIX timestamp or an error.

$result = \Missing\Dates::parse(get_post_meta($post->ID, '_EventStartDate', true));
if ($result->isErr()) {
  $date = 'Unknown date';
} else {
  $date = strftime('%e %B %Y', $result->unwrap());
}

The following date formats are parsed:

$date = \Missing\Dates::strftime($date_string, $format, $else, $tz)

Parses $date_string using \Missing\Dates::parse() (also accepts a UTC timestamp), if it parses correctly, return the date formatted with $format in the timezone $tz, otherwise return $else.

<p>Date: </p>

Ints

$string = \Missing\Ints::ordinalize($number)

Returns English ordinals for any given integer (i.e. 1 => "1st", 2 => "2nd").

Copied directly from active_record's Inflector#ordinalize (also MIT licensed).

Reflection

$value = \Missing\Reflection::call($object, $methodName, $arguments)

Calls private or protected method $methodName of $object with $arguments (an array) and returns what it returns.

Strings

$bool = \Missing\Strings::startsWith($haystack, $needle)

Returns true if string $haystack starts with $needle (uses substr() - regexes not supported).

$bool = \Missing\Strings::endsWith($haystack, $needle)

Returns true if string $haystack ends with $needle (uses substr() - regexes not supported).

$string = \Missing\Strings::getOutput($callback)

Executes $callback, returns what it prints as a string.

Licence

MIT - see COPYING.md

\Missing\Ints::ordinal and \Missing\Ints::ordinalize were ported from the Rails active_support module, also licensed under MIT.


All versions of php-missing with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4||^8.1
dxw/result Version ^1.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 dxw/php-missing contains the following files

Loading the files please wait ....