{"id":14987282,"url":"https://github.com/jason-napolitano/codeigniter4-cart-module","last_synced_at":"2026-02-22T22:39:27.957Z","repository":{"id":41390631,"uuid":"214366817","full_name":"jason-napolitano/CodeIgniter4-Cart-Module","owner":"jason-napolitano","description":"A basic port of the CodeIgniter 3 cart library for CodeIgniter 4.","archived":false,"fork":false,"pushed_at":"2025-03-26T18:01:29.000Z","size":65,"stargazers_count":57,"open_issues_count":0,"forks_count":28,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-04-07T18:11:17.843Z","etag":null,"topics":["cart","codeigniter","codeigniter4","library","module","php","shopping-cart"],"latest_commit_sha":null,"homepage":"https://packagist.org/packages/jason-napolitano/codeigniter4-cart-module","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/jason-napolitano.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}},"created_at":"2019-10-11T07:03:02.000Z","updated_at":"2025-04-04T03:43:17.000Z","dependencies_parsed_at":"2023-02-08T17:15:43.116Z","dependency_job_id":null,"html_url":"https://github.com/jason-napolitano/CodeIgniter4-Cart-Module","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jason-napolitano%2FCodeIgniter4-Cart-Module","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jason-napolitano%2FCodeIgniter4-Cart-Module/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jason-napolitano%2FCodeIgniter4-Cart-Module/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jason-napolitano%2FCodeIgniter4-Cart-Module/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jason-napolitano","download_url":"https://codeload.github.com/jason-napolitano/CodeIgniter4-Cart-Module/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247704571,"owners_count":20982298,"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":["cart","codeigniter","codeigniter4","library","module","php","shopping-cart"],"created_at":"2024-09-24T14:14:22.595Z","updated_at":"2026-02-22T22:39:27.923Z","avatar_url":"https://github.com/jason-napolitano.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CodeIgniter4-Cart-Module\n\u003e This is a `composer` installable, CodeIgniter 4 module that is nearly a direct port of the Codeigniter 3 Cart Library Class.\n\u003e Of course, this has been mildly updated and is consistent with the new version of the framework.\n\u003e \n\u003e This means that instead of just being a _class_ that you can use in your projects, this library\n\u003e has been updated with Namespaces, has been refactored to adhere to the CodeIgniter style guide \n\u003e and also has been built to use CodeIgniter 4's Service Container to allow for a shared Cart instance \n\u003e across your application.  \n\u003e \n\u003e More detailed documentation can be found [here](https://codeigniter.com/userguide3/libraries/cart.html). Please\n\u003e note that the documentation is for the CodeIgniter 3 library but the fundamentals and inner workings of the \n\u003e library are still identical. The most notable changes are how you use it (read below) and to return \n\u003e the total items in your cart, you now call `$cart-\u003etotalItems()` instead of `$this-\u003ecart-\u003etotal_items()`.\n\u003e \n\u003e Please take note that there are no tests for this package, nor is it officially supported since it is just a port from\n\u003e an existing Codeigniter library and works exactly the same.\n\n## Installation:\n - Install via composer `composer require jason-napolitano/codeigniter4-cart-module`\n - Add it to the `$psr4` array in `app/Config/Autoload.php`:\n ```php\n$psr4 = [\n    'CodeIgniterCart' =\u003e ROOTPATH . 'vendor/jason-napolitano/codeigniter4-cart-module/src'\n\n    // OTHER PSR4 ENTRIES\n];\n``` \n  \n## Usage\n ```php\n // Call the cart service\n $cart = \\Config\\Services::cart();\n \n // Insert an array of values\n $cart-\u003einsert(array(\n    'id'      =\u003e 'sku_1234ABCD',\n    'qty'     =\u003e 1,\n    'price'   =\u003e '19.56',\n    'name'    =\u003e 'T-Shirt',\n    'options' =\u003e array('Size' =\u003e 'L', 'Color' =\u003e 'Red')\n));\n \n // Update an array of values\n $cart-\u003eupdate(array(\n    'rowid'   =\u003e '4166b0e7fc8446e81e16883e9a812db8',\n    'id'      =\u003e 'sku_1234ABCD',\n    'qty'     =\u003e 3,\n    'price'   =\u003e '24.89',\n    'name'    =\u003e 'T-Shirt',\n    'options' =\u003e array('Size' =\u003e 'L', 'Color' =\u003e 'Red')\n));\n\n// Get the total items. Formerly known as total_items()\n$cart-\u003etotalItems();\n\n// Remove an item using its `rowid`\n$cart-\u003eremove('4166b0e7fc8446e81e16883e9a812db8');\n   \n// Clear the shopping cart\n$cart-\u003edestroy();\n\n// Get the cart contents as an array\n$cart-\u003econtents();\n```\n \n## License:\n MIT License\n\nCopyright (c) 2025 Jason Napolitano\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjason-napolitano%2Fcodeigniter4-cart-module","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjason-napolitano%2Fcodeigniter4-cart-module","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjason-napolitano%2Fcodeigniter4-cart-module/lists"}