{"id":25081800,"url":"https://github.com/rapideinternet/phpcart","last_synced_at":"2026-06-08T16:02:08.817Z","repository":{"id":42627039,"uuid":"60016463","full_name":"rapideinternet/phpcart","owner":"rapideinternet","description":null,"archived":false,"fork":false,"pushed_at":"2023-12-15T02:32:34.000Z","size":10,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2023-12-15T03:52:34.598Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/rapideinternet.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":"2016-05-30T14:31:48.000Z","updated_at":"2023-12-15T03:52:34.600Z","dependencies_parsed_at":"2025-02-07T05:20:37.241Z","dependency_job_id":"f4cdbb67-f654-4674-9f4e-ede7192ee646","html_url":"https://github.com/rapideinternet/phpcart","commit_stats":null,"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"purl":"pkg:github/rapideinternet/phpcart","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rapideinternet%2Fphpcart","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rapideinternet%2Fphpcart/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rapideinternet%2Fphpcart/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rapideinternet%2Fphpcart/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rapideinternet","download_url":"https://codeload.github.com/rapideinternet/phpcart/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rapideinternet%2Fphpcart/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34069501,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-08T02:00:07.615Z","response_time":111,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2025-02-07T05:18:59.392Z","updated_at":"2026-06-08T16:02:08.800Z","avatar_url":"https://github.com/rapideinternet.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PHPCart\nSimple framework agnostic shopping cart.\n\n## Features\n\n- Simple API\n- Support multiple cart instances\n- Framework agnostic, with optional Laravel integration\n\n## Requirements\n\n- PHP 5.4+\n\n## Installation\nPHPCart is available via Composer\n\n```bash\n$ composer require anam/phpcart\n```\n\n## Integrations\n\nLaravel 4 and Laravel 5 integrations\n\nAlthough PHPCart is framework agnostic, it does support Laravel out of the box and comes with a Service provider and Facade for easy integration.\n\nAfter you have installed the PHPCart, open the config/app.php file which is included with Laravel and add the following lines.\n\nIn the $providers array add the following service provider.\n\n```php\n'Anam\\Phpcart\\CartServiceProvider'\n```\n\nAdd the facade of this package to the $aliases array.\n\n```php\n'Cart' =\u003e 'Anam\\Phpcart\\Facades\\Cart'\n```\n\nYou can now use this facade in place of instantiating the Cart yourself in the following examples.\n\n## Usage\n\n### Add Item\n\nThe add method required `id`, `name`, `price` and `quantity` keys. However, you can pass any data that your application required.\n\n```php\nuse Anam\\Phpcart\\Cart;\n\n$cart = new Cart();\n\n$cart-\u003eadd([\n    'id'       =\u003e 1001,\n    'name'     =\u003e 'Skinny Jeans',\n    'quantity' =\u003e 1,\n    'price'    =\u003e 90\n]);\n```\n\n### Update Item\n\n\n```php\n$cart-\u003eupdate([\n    'id'       =\u003e 1001,\n    'name'     =\u003e 'Hoodie'\n]);\n```\n\n### Update quantity\n\n\n```php\n$cart-\u003eupdateQty(1001, 3);\n```\n\n### Update price\n\n```php\n$cart-\u003eupdatePrice(1001, 30);\n```\n\n### Remove an Item\n\n```php\n$cart-\u003eremove(1001);\n```\n\n### Get all Items\n\n```php\n$cart-\u003egetItems();\n// or\n$cart-\u003eitems();\n```\n\n### Get an Item\n\n```php\n$cart-\u003eget(1001);\n```\n\n### Determining if an Item exists in the cart\n\n```php\n$cart-\u003ehas(1001);\n```\n\n### Get the total number of items in the cart\n\n```php\n$cart-\u003ecount();\n```\n\n### Get the total quantities of items in the cart\n\n```php\n$cart-\u003etotalQuantity();\n```\n\n### Total sum\n\n```php\n$cart-\u003egetTotal();\n```\n\n### Empty the cart\n\n```php\n$cart-\u003eclear();\n```\n\n### Multiple carts\n\nPHPCart supports multiple cart instances, so that you can have as many shopping cart instances on the same page as you want without any conflicts. \n\n```php\n$cart = new Cart('cart1');\n// or\n$cart-\u003esetCart('cart2');\n$cart-\u003eadd([\n    'id'       =\u003e 1001,\n    'name'     =\u003e 'Skinny Jeans',\n    'quantity' =\u003e 1,\n    'price'    =\u003e 90\n]);\n\n//or\n$cart-\u003enamed('cart3')-\u003eadd([\n    'id'       =\u003e 1001,\n    'name'     =\u003e 'Jeans',\n    'quantity' =\u003e 2,\n    'price'    =\u003e 100\n]);\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frapideinternet%2Fphpcart","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frapideinternet%2Fphpcart","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frapideinternet%2Fphpcart/lists"}