{"id":15698208,"url":"https://github.com/dcblogdev/phpcart","last_synced_at":"2025-09-04T04:35:37.161Z","repository":{"id":45247203,"uuid":"280244748","full_name":"dcblogdev/phpcart","owner":"dcblogdev","description":"Simple framework agnostic shopping cart (Built by anam-hossain/phpcart)","archived":false,"fork":false,"pushed_at":"2023-02-05T00:32:25.000Z","size":12,"stargazers_count":6,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-16T02:35:48.944Z","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/dcblogdev.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}},"created_at":"2020-07-16T19:50:37.000Z","updated_at":"2022-12-27T00:44:01.000Z","dependencies_parsed_at":"2023-02-18T20:20:37.911Z","dependency_job_id":null,"html_url":"https://github.com/dcblogdev/phpcart","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/dcblogdev/phpcart","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcblogdev%2Fphpcart","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcblogdev%2Fphpcart/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcblogdev%2Fphpcart/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcblogdev%2Fphpcart/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dcblogdev","download_url":"https://codeload.github.com/dcblogdev/phpcart/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcblogdev%2Fphpcart/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273551463,"owners_count":25125731,"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","status":"online","status_checked_at":"2025-09-04T02:00:08.968Z","response_time":61,"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":"2024-10-03T19:23:52.796Z","updated_at":"2025-09-04T04:35:37.107Z","avatar_url":"https://github.com/dcblogdev.png","language":"PHP","readme":"# PHPCart\nSimple framework agnostic shopping cart.\n\nOriginally from https://github.com/anam-hossain/phpcart I've released this under my own namespace as I needed support for Laravel 7/8, at the time of writing this there is an open PR on the original repo which has not been responded to.\n\n## Features\n\n- Simple API\n- Support multiple cart instances\n- Framework agnostic\n\n## Requirements\n\n- PHP 7.3+\n\n## Installation\nPHPCart is available via Composer\n\n```bash\n$ composer require dcblogdev/phpcart\n```\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 Dcblogdev\\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```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdcblogdev%2Fphpcart","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdcblogdev%2Fphpcart","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdcblogdev%2Fphpcart/lists"}