{"id":18319422,"url":"https://github.com/kariricode-framework/kariricode-contract","last_synced_at":"2025-04-05T21:33:33.108Z","repository":{"id":246415947,"uuid":"773499453","full_name":"KaririCode-Framework/kariricode-contract","owner":"KaririCode-Framework","description":"The KaririCode Contract Component defines core interfaces and contracts for the KaririCode Framework, promoting modularity and adherence to best practices. It ensures consistency across components and supports PSR standards, enabling seamless integration and strong typing for PHP applications.","archived":false,"fork":false,"pushed_at":"2025-03-06T16:05:53.000Z","size":263,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-03-21T12:57:34.880Z","etag":null,"topics":["framework","framework-php","interfaces","php"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/KaririCode-Framework.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2024-03-17T20:28:26.000Z","updated_at":"2025-03-06T16:05:11.000Z","dependencies_parsed_at":null,"dependency_job_id":"1aef8fe2-0a20-4564-afb1-c5500d37c20a","html_url":"https://github.com/KaririCode-Framework/kariricode-contract","commit_stats":null,"previous_names":["kariricode-framework/kariricode-contract"],"tags_count":31,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KaririCode-Framework%2Fkariricode-contract","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KaririCode-Framework%2Fkariricode-contract/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KaririCode-Framework%2Fkariricode-contract/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KaririCode-Framework%2Fkariricode-contract/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/KaririCode-Framework","download_url":"https://codeload.github.com/KaririCode-Framework/kariricode-contract/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247406076,"owners_count":20933803,"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":["framework","framework-php","interfaces","php"],"created_at":"2024-11-05T18:13:18.708Z","updated_at":"2025-04-05T21:33:32.740Z","avatar_url":"https://github.com/KaririCode-Framework.png","language":"PHP","readme":"# KaririCode Framework: Contract Component\n\n[![en](https://img.shields.io/badge/lang-en-red.svg)](README.md)\n[![pt-br](https://img.shields.io/badge/lang-pt--br-green.svg)](README.pt-br.md)\n\n![Docker](https://img.shields.io/badge/Docker-2496ED?style=for-the-badge\u0026logo=docker\u0026logoColor=white)\n![Makefile](https://img.shields.io/badge/Makefile-1D1D1D?style=for-the-badge\u0026logo=gnu\u0026logoColor=white)\n![PHP](https://img.shields.io/badge/PHP-777BB4?style=for-the-badge\u0026logo=php\u0026logoColor=white)\n![PHPUnit](https://img.shields.io/badge/PHPUnit-78E130?style=for-the-badge\u0026logo=phpunit\u0026logoColor=white)\n\n## Overview\n\nThe Contract component is a fundamental part of the KaririCode Framework, providing a comprehensive set of interfaces that define contracts for various data structures and behaviors. These interfaces serve as the foundation for implementing robust, consistent, and interoperable data structure components within and beyond the KaririCode ecosystem.\n\n## Key Features\n\n- **Comprehensive Set of Interfaces**: Covers a wide range of data structures and behaviors.\n- **Type Safety**: Leverages PHP 8.3+ features for better type checking and higher code reliability.\n- **Flexibility**: Allows multiple implementations of the same interface, promoting code reuse and modularity.\n- **Standardization**: Provides a consistent API across different implementations.\n\n## Available Interfaces and Their Applications\n\n### Structural Interfaces\n\n#### Collection\n\nDefines the contract for a collection of elements. Ideal for implementing lists, sets, and other custom collections.\n\n**Suggested Applications:**\n\n- Implementing a product catalog in an e-commerce site.\n- Managing a task list in a productivity app.\n\n#### Map\n\nDefines the contract for map data structures, which store key-value pairs.\n\n**Suggested Applications:**\n\n- Implementing an in-memory data cache.\n- Managing user sessions in a web application.\n\n#### Set\n\nDefines the contract for set data structures, which do not allow duplicate elements.\n\n**Suggested Applications:**\n\n- Maintaining a unique list of tags in a blog system.\n- Implementing a spam filter based on IP addresses.\n\n#### Queue\n\nDefines the contract for queue data structures, which follow the FIFO (First-In-First-Out) principle.\n\n**Suggested Applications:**\n\n- Order processing system in a restaurant.\n- Task management in a print system.\n\n#### Stack\n\nDefines the contract for stack data structures, which follow the LIFO (Last-In-First-Out) principle.\n\n**Suggested Applications:**\n\n- Implementing a browser history in a web browser.\n- Managing function calls in a programming language interpreter.\n\n#### Tree\n\nDefines the contract for tree data structures.\n\n**Suggested Applications:**\n\n- Representing hierarchical structures such as product categories.\n- Implementing a virtual file system.\n\n#### Heap\n\nDefines the contract for heap data structures.\n\n**Suggested Applications:**\n\n- Implementing a priority queue in a customer service system.\n- Optimizing sorting and search algorithms.\n\n#### Deque\n\nExtends the Queue interface to define the contract for double-ended queue structures.\n\n**Suggested Applications:**\n\n- Implementing a circular buffer for stream processing.\n- Developing a card game where cards can be added or removed from both ends.\n\n### Behavioral Interfaces\n\n#### Countable, Indexable, Modifiable, Searchable\n\nThese interfaces define common behaviors that can be applied to various data structures.\n\n**Suggested Applications:**\n\n- Implementing custom collections with specific functionalities.\n- Developing wrappers for existing data structures to add new features.\n\n#### Sortable, Comparable\n\nDefine contracts for objects that can be sorted and compared.\n\n**Suggested Applications:**\n\n- Implementing custom sorting algorithms.\n- Developing ordered data structures, such as binary search trees.\n\n#### IterableCollection, Iterator\n\nProvide the ability to iterate over a collection.\n\n**Suggested Applications:**\n\n- Implementing custom collections that can be used in foreach loops.\n- Developing specialized iterators to traverse complex data structures.\n\n### Specialized Interfaces\n\n#### BPlusTreeCollection\n\nDefines the contract for B+ tree data structures.\n\n**Suggested Applications:**\n\n- Implementing database indexes for fast queries.\n- Optimizing file systems for quick access to large volumes of data.\n\n#### Serializable\n\nDefines the contract for serializing and deserializing data.\n\n**Suggested Applications:**\n\n- Implementing a cache system that can store complex objects.\n- Developing a custom data persistence mechanism.\n\n## Installation\n\n### Requirements\n\n- PHP 8.3 or higher\n- Composer\n\n### Via Composer\n\n```bash\ncomposer require kariricode/contract\n```\n\n## Usage\n\nTo use these interfaces in your project, simply implement them in your classes. For example:\n\n```php\nuse KaririCode\\Contract\\DataStructure\\Collection;\n\nclass MyCollection implements Collection\n{\n    // Implement the methods defined in the Collection interface\n}\n```\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## Support and Community\n\n- **Documentation**: [https://kariricode.org](https://kariricode.org)\n- **Issue Tracker**: [GitHub Issues](https://github.com/KaririCode-Framework/kariricode-contract/issues)\n- **Community**: [KaririCode Club Community](https://kariricode.club)\n- **Professional Support**: For enterprise-level support, contact us at support@kariricode.org\n\n## Acknowledgments\n\n- The KaririCode Framework team and contributors.\n- The PHP community for their continuous support and inspiration.\n\n---\n\nBuilt with ❤️ by the KaririCode team. Empowering developers to build more robust and flexible PHP applications.\n\nMaintained by Walmir Silva - [walmir.silva@kariricode.org](mailto:walmir.silva@kariricode.org)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkariricode-framework%2Fkariricode-contract","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkariricode-framework%2Fkariricode-contract","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkariricode-framework%2Fkariricode-contract/lists"}