Download the PHP package obernard/linkedlist without Composer

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

🖇 LinkedList

Linked List implementation in PHP.

Installation

Usage of final class LifoList

Final classes like LifoList are given as examples of implementation of abstract linked-list classes but extending AbstractSinglyLinkedList or AbstractDoublyLinkedList offers much more coding potentials.

Create an empty list and add nodes.

Usage of Abstract classes

Abstract singly-linked list supports the use of abstract doubly-linked nodes but as a good practice use singly linked nodes inside singly-linked lists.

Your concrete list class links instances of your concrete node classe. Concrete list classes may create node objects - like LifoList class does - or may not.

In this example, MyList class does not create nodes by itself:

A Node classe implements IterableNodeInterface getKey and getValue methods through AbstractNode. You may need to replace one or the other.

In above example, we decide that foreach statement iterate over $data node property.

If you want to iterate over Node objects, do not replace getValue because AbstractNode->getValue() already returns $this.

@see AbstractCommonList key() and current() methods to see how the magic works.

Dialogue between nodes

An interesting design pattern is to make nodes communicate through the list.

See AbstractNode distanceToLastNode() method as an example of inter-nodes communication:

This design pattern is based on recursivity.

The time complexity of such recursive methods is 0(n) where n is the number of nodes.

If your configuration has xdebug module enabled, the use of such recursive function calls may raise the following error if your list length get close to 256:

If you don't want to modify your xdebug config by increasing the xdebug.max_nesting_level setting, just don't use that pattern design for long lists.

Be carefull not to use recursive communication methods between nodes when iterating over nodes because the time complexity would be O(n2) leading to very poor performance.

Tests

Run composer test.

Contributing

Improvements are welcome! Feel free to submit pull requests.

Licence

MIT

Copyright (c) 2021 Olivier BERNARD


All versions of linkedlist 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 obernard/linkedlist contains the following files

Loading the files please wait ....