Download the PHP package petrobolos/fixed-array-functions without Composer

On this page you can find all versions of the php package petrobolos/fixed-array-functions. 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 fixed-array-functions

Fixed Array Functions

Latest Version on Packagist GitHub issues GitHub Tests Action Status GitHub Code Style Action Status Total Downloads GitHub

SplFixedArrays are an implementation of a traditional, bounded array in the PHP standard library.

While they require manual resizing, they're significantly faster than regular arrays or collections when working with large sets of data.

Requirements

Currently, requires PHP 8.4 or above, and Laravel 12+.

Installation

You can install the package via Composer:

Quick Start

Fluent interface

FixedArray is best used with its fluent interface. If you're familiar with Illuminate collections, you'll feel right at home. Provide it an SplFixedArray to get started, or a standard array or collection that will be automatically converted.

Static methods

You aren't forced to use the fluent interface and can access methods directly by calling them. This is useful if you only need to do one or two operations on a fixed array.

Real-World Examples

Processing Large Datasets

Data Aggregation

Conditional Transformations

Partitioning Data

Performance Benefits

SplFixedArray offers significant performance advantages over standard PHP arrays for large datasets:

When to use SplFixedArray:

When to stick with regular arrays/Collections:

Full list of available methods

Method Description
add Alias for push.
addFrom Add an array or collection of items to a fixed array.
all Alias for every.
avg Calculate the average of numeric values.
average Alias for avg.
chunk Split a fixed array into chunks of a given size.
chunkWhile Split a fixed array into chunks while a callback returns true.
contains Check whether an item exists in a fixed array.
count Return the number of elements.
create Create a new fixed array of a given size.
dsfargeg DSFARGEG
each Apply a callback to each item without modifying the original array.
every Determine if all items pass a given test.
fill Fill the array with a single value.
filter Filter the array using a callback (passes key to callback).
find Return the first element matching a callback.
findKey Return the key of the first element matching a callback.
findIndex Alias for findKey.
first Return the first element of the array.
flatten Flatten nested arrays, collections, and fixed arrays.
fluent Creates a new fluent interface for chaining methods.
fromArray Create a fixed array from a standard array.
fromCollection Create a fixed array from an Illuminate collection.
getSize Return the number of elements in the array.
implode Alias for join.
isEmpty Check if the array is empty.
isFixedArray Check whether a value is a fixed array.
isNotEmpty Check if the array is not empty.
join Join array elements with a string.
keys Get all keys (indices) from the array.
last Return the last element of the array.
map Apply a callback to each item and return a new array.
max Find the maximum value.
merge Merge multiple arrays, fixed arrays, or collections.
min Find the minimum value.
nullify Replace all elements with null.
offsetExists Check if an index exists in the array.
offsetGet Get the value at a specific index.
offsetNull Set a specific index to null.
offsetSet Set a value at a specific index.
partition Split array into two groups based on a callback.
pipe Pass the array through a callback and return the result.
pluck Extract values from a specific property or key.
pop Remove and return the last element.
push Add a value to the first available space.
random Return a random element from the array.
reduce Reduce the array to a single value using a callback.
reject Filter out items that pass the test (opposite of filter).
resize Alias for setSize.
reverse Reverse the order of elements.
second Return the second element.
setSize Resize the array to a given size.
shift Remove and return the first element.
shuffle Shuffle the array in a secure manner.
slice Return a subset of the array.
some Determine if at least one item passes a given test.
sort Sort the array optionally using a callback.
sum Sum all numeric values in the array.
tap Pass the array to a callback and return the array.
toArray Convert the fixed array into a standard PHP array.
toCollection Convert the fixed array into an Illuminate collection.
unique Remove duplicate values from the array.
unshift Prepend one or more values to the array.
unless Apply callback if the condition is false.
values Get all values from the array (reindexed).
when Apply callback if the condition is true.

Testing

Tests are run using Pest. You can run the suite like so:

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

We welcome pull requests, especially those improving the package's optimisation and speed, and new features to bring it into parity with Collection.

Please ensure any functionality submitted has adequate test coverage and documentation (at least in English.)

License

The MIT License (MIT). Please see License File for more information.


All versions of fixed-array-functions with dependencies

PHP Build Version
Package Version
Requires php Version ^8.4
spatie/laravel-package-tools Version ^1.92
illuminate/contracts Version ^13.0|^12.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 petrobolos/fixed-array-functions contains the following files

Loading the files please wait ...