onkud / data-structures
Stack, Queue, and LinkedList implementations with Laravel and Symfony support
Requires
- php: ^8.1
Requires (Dev)
- illuminate/support: ^13.35
- symfony/dependency-injection: ^6.0 || ^7.0
- symfony/http-kernel: ^6.0 || ^7.0
Suggests
- illuminate/support: Required to use the Laravel ServiceProvider (^9.0 || ^10.0 || ^11.0)
- symfony/http-kernel: Required to use the Symfony Bundle (^6.0 || ^7.0)
Provides
None
Conflicts
None
Replaces
None
README
A lightweight PHP implementation and benchmark comparing core data structures: Stack, Queue, and LinkedList.
Requirements
- PHP 8.1 or higher
- Composer
Installation
Standalone PHP Project
-
Clone or download the repository:
git clone https://github.com/onurkudrt/php-data-structures.git cd php-data-structures -
Install dependencies:
composer install
-
Run benchmark / tests:
php tests.php
Symfony Installation
-
Install package with composer:
composer require onkud/data-structures
-
Register the bundle in config/bundles.php to enable autowiring and dependency injection:
<?php return [ ..., \OnKud\DataStructures\Bridges\Symfony\DataStructureBundle::class => ['all' => true], ];
-
Use in your services or controllers:
use OnKud\DataStructures\Stack\Interface\StackInterface; use OnKud\DataStructures\LinkedList\Interface\LinkedListInterface; class DemoController { public function __invoke(StackInterface $stack, LinkedListInterface $list) { $stack->push('item'); // ... } }
Laravel Installation
-
Install package with composer:
-
composer require onkud/data-structures
- NOTE: Laravel auto-discovers the Service Provider automatically via composer.json
-
-
Use in your services or controllers:
use OnKud\DataStructures\Stack\Interface\StackInterface; class DemoController extends Controller { public function index(StackInterface $stack) { $stack->push('item'); // ... } }
Install via GitHub (Without Packagist)
If this package is not published on Packagist, users can require it directly from GitHub by adding your repository to their project's composer.json:
-
Add the GitHub repository to the project's
composer.json:{ "repositories": [ { "type": "vcs", "url": "https://github.com/onurkudrt/php-data-structures.git" } ] } -
Require the package via Composer:
composer require onkud/data-structures:dev-main