{"id":23243715,"url":"https://github.com/samyouaret/php-datastructure","last_synced_at":"2025-04-05T23:25:27.665Z","repository":{"id":124163302,"uuid":"219032632","full_name":"samyouaret/php-datastructure","owner":"samyouaret","description":" A small PHP data-structure package","archived":false,"fork":false,"pushed_at":"2019-11-07T02:12:37.000Z","size":27,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-12T05:45:13.565Z","etag":null,"topics":["algorithms","data-structures","linked-list","php","queue","stack"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/samyouaret.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-11-01T17:31:59.000Z","updated_at":"2019-11-09T13:20:16.000Z","dependencies_parsed_at":null,"dependency_job_id":"46253e0d-502f-43fe-b30a-a69e4c7082db","html_url":"https://github.com/samyouaret/php-datastructure","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samyouaret%2Fphp-datastructure","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samyouaret%2Fphp-datastructure/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samyouaret%2Fphp-datastructure/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samyouaret%2Fphp-datastructure/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/samyouaret","download_url":"https://codeload.github.com/samyouaret/php-datastructure/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247414558,"owners_count":20935242,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["algorithms","data-structures","linked-list","php","queue","stack"],"created_at":"2024-12-19T06:17:45.573Z","updated_at":"2025-04-05T23:25:27.653Z","avatar_url":"https://github.com/samyouaret.png","language":"PHP","readme":"PHP data structure package\n==========================\n\nThis package was not intended to replace the data structure provided by standard PHP library\n(**SPL**) , this is package created just for demonstration and teaching purposes and contains the implementation details to basic operations performed by legacy data structure like linked lists providing classes like DoublyLinkedList, Stack and Queue to achieve desired tasks.\n\n\nRequirements\n------------\n\nPHP needs to be a minimum version of PHP 7.1.0.\n\nInstallation\n------------\n\nat the moment the package is not published at packagist yet, you can clone the package :\n\n... code-bock:: bash\n\n    $ git clone https://github.com/samyouaret/php-datastructure.git\n\nUsage\n------------\n\n``DoublyLinkedList`` provides rich api the perform mostly tasks needed by linked list \n\nand stacks and queues.\n\ncreate instance of ``DoublyLinkedList`` and push to it :\n\n```php\n\u003c?php\n\n        $this-\u003elist = new DoublyLinkedList();\n        $this-\u003elist-\u003epush(5);\n```\n\n``DoublyLinkedList`` implements ``AbstractList`` so you can use all methods listed below :\n\n```php\n\u003c?php\n\n    public function __construct($value); // optional initial value\n    public function empty(): bool;\n    public function push($item); \n    public function first(); //return first item of list\n    public function last();  //return last item of list\n    public function add(int $index, $item); //add item at given index\n    public function get(int $index);  //return item at given index\n    public function remove(int $index); //remove and return item at given index\n    public function pop();  //remove and return last item\n    public function removeItem($item); //search and remove item return it,accepts callback compare     \n    public function search($item); //search and item return it,accepts callback compare     \n    public function clear(); //clear all items of list\n\n```\n\n``Stack`` is a child of ``DoublyLinkedList`` and provide alias to last method as top of list :\n\n```php\n\u003c?php\n\n           public function top();//return top of list\n\n```\n\n``Queue`` is a child of ``DoublyLinkedList`` implements ``AbstractQueue`` so it provides \n\nmethods listed below just for convention and clarity since are just wrappers of \n\n``doublylinkedList`` methods:\n\n```php\n\u003c?php\n\n    public function enqueue($value);\n    public function dequeue();\n    public function peek();\n\n```","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamyouaret%2Fphp-datastructure","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsamyouaret%2Fphp-datastructure","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamyouaret%2Fphp-datastructure/lists"}