{"id":14987258,"url":"https://github.com/samsonasik/ci4-album","last_synced_at":"2025-04-04T16:14:51.976Z","repository":{"id":38847811,"uuid":"245387516","full_name":"samsonasik/ci4-album","owner":"samsonasik","description":"🔥 CodeIgniter 4 example Album module uses Domain Driven Design Architecture with Tactical Pattern","archived":false,"fork":false,"pushed_at":"2025-01-20T11:52:53.000Z","size":406,"stargazers_count":93,"open_issues_count":0,"forks_count":21,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-03-28T15:08:10.967Z","etag":null,"topics":["album","codeigniter","codeigniter4","database","ddd","domain-driven-design","layout","module","pagination","post-redirect-get","prg","query","reusable","search","tactical-pattern","tested"],"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/samsonasik.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","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},"funding":{"github":"samsonasik"}},"created_at":"2020-03-06T10:09:13.000Z","updated_at":"2025-02-06T00:38:53.000Z","dependencies_parsed_at":"2023-02-18T22:05:26.232Z","dependency_job_id":"b5117535-6236-4b90-9da0-bdbfcbf8b9a8","html_url":"https://github.com/samsonasik/ci4-album","commit_stats":{"total_commits":246,"total_committers":3,"mean_commits":82.0,"dds":0.03658536585365857,"last_synced_commit":"10b53bf935d8bfe3301865d76cf1da8d2b82ed29"},"previous_names":[],"tags_count":46,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samsonasik%2Fci4-album","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samsonasik%2Fci4-album/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samsonasik%2Fci4-album/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samsonasik%2Fci4-album/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/samsonasik","download_url":"https://codeload.github.com/samsonasik/ci4-album/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247208150,"owners_count":20901570,"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":["album","codeigniter","codeigniter4","database","ddd","domain-driven-design","layout","module","pagination","post-redirect-get","prg","query","reusable","search","tactical-pattern","tested"],"created_at":"2024-09-24T14:14:20.543Z","updated_at":"2025-04-04T16:14:51.927Z","avatar_url":"https://github.com/samsonasik.png","language":"PHP","funding_links":["https://github.com/sponsors/samsonasik"],"categories":[],"sub_categories":[],"readme":"Example of CodeIgniter 4 Module : Album Module\n==============================================\n\n[![Latest Version](https://img.shields.io/github/release/samsonasik/ci4-album.svg?style=flat-square)](https://github.com/samsonasik/ci4-album/releases)\n![ci build](https://github.com/samsonasik/ci4-album/workflows/ci%20build/badge.svg)\n[![Mutation testing badge](https://img.shields.io/endpoint?style=flat\u0026url=https%3A%2F%2Fbadge-api.stryker-mutator.io%2Fgithub.com%2Fsamsonasik%2Fci4-album%2Fmaster)](https://dashboard.stryker-mutator.io/reports/github.com/samsonasik/ci4-album/master)\n[![Code Coverage](https://codecov.io/gh/samsonasik/ci4-album/branch/master/graph/badge.svg)](https://codecov.io/gh/samsonasik/ci4-album)\n[![PHPStan](https://img.shields.io/badge/style-level%20max-brightgreen.svg?style=flat-square\u0026label=phpstan)](https://github.com/phpstan/phpstan)\n[![Downloads](https://poser.pugx.org/samsonasik/ci4-album/downloads)](https://packagist.org/packages/samsonasik/ci4-album)\n\nFeature\n-------\n\n- [x] CRUD with\n   - [x] [Domain Driven Design Architecture](https://en.wikipedia.org/wiki/Domain-driven_design) with [Tactical Pattern](http://gorodinski.com/blog/2012/04/25/read-models-as-a-tactical-pattern-in-domain-driven-design-ddd/)\n   - [x] [Post/Redirect/Get pattern](https://en.wikipedia.org/wiki/Post/Redirect/Get)\n- [x] Pagination, configurable via [`Album\\Config\\Album`](#settings) class.\n- [x] Search\n- [x] Layout\n- [x] Flash Message after add/edit/delete\n\nInstallation\n------------\n\n**1.** Get The Module\n\n**a.** require via composer\n\n```bash\ncomposer require samsonasik/ci4-album\n```\n\n**OR**\n\n**b.** manually, by go to `app/ThirdParty` directory in project root, and clone this repository to the `app/ThirdParty` directory:\n\n```bash\ncd app/ThirdParty\ngit clone git@github.com:samsonasik/ci4-album.git\n```\n\n\u003e see https://help.github.com/en/github/authenticating-to-github/error-permission-denied-publickey# for common clone issue troubleshooting.\n\nthen register \"Album\" to `App/Config/Autoload.php`'s psr4 property:\n\n```php\n\t\t$psr4 = [\n\t\t\t'App'         =\u003e APPPATH,                // To ensure filters, etc still found,\n\t\t\tAPP_NAMESPACE =\u003e APPPATH,                // For custom namespace\n\t\t\t'Config'      =\u003e APPPATH . 'Config',\n\t\t\t'Album'       =\u003e APPPATH . 'ThirdParty/ci4-album/src', // \u003c-- add this line\n\t\t];\n```\n\n**2.** Set CI_ENVIRONMENT, base url, index page, and database config in your `.env` file based on your existing database (If you don't have a `.env` file, you can copy first from `env` file: `cp env .env` first). If the database not exists, create database first.\n\n```bash\n# .env file\nCI_ENVIRONMENT = development\n\napp.baseURL = 'http://localhost:8080'\napp.indexPage = ''\n\ndatabase.default.hostname = localhost\ndatabase.default.database = ci4_crud\ndatabase.default.username = root\ndatabase.default.password =\ndatabase.default.DBDriver = MySQLi\n```\n\n**3.** Run db migration\n\n```bash\nphp spark migrate -n Album\n```\n\n**4.** Run db seed (Optional)\n\n```bash\nphp spark db:seed \"Album\\Database\\Seeds\\AlbumSeeder\"\nphp spark db:seed \"Album\\Database\\Seeds\\TrackSeeder\"\n```\n\n**5.** Run development server:\n\n```bash\nphp spark serve\n```\n\n**6.** Open in browser http://localhost:8080/album\n\nSettings\n--------\n\nConfigure pagination per-page, by copy `src/Config/Album.php` file into `app/Config` directory, and modify the namespace to `Config`:\n\n```php\n\u003c?php namespace Config;\n\nuse CodeIgniter\\Config\\BaseConfig;\n\nclass Album extends BaseConfig\n{\n    public $paginationPerPage = 10;\n}\n// app/Config/Album.php\n```\n\nIn above class, the `paginationPerPage` property's value can be changed.\n\nTesting\n-------\n\nOn very first run, you need to create database, and migration for testing purpose with set `phpunit.xml` file from `phpunit.xml.dist`:\n\n```bash\ncd /path/to/modules/ci4-album\ncp phpunit.xml.dist phpunit.xml\n```\n\nand then configure the `phpunit.xml` to ensure it has a match db configuration with your local dev environment.  If the database not exists, create database first.\n\n```xml\n\t\u003cphp\u003e\n\t\t\u003cserver name=\"app.baseURL\" value=\"http://localhost:8080\"/\u003e\n\t\t\u003cconst name=\"HOMEPATH\" value=\"./\"/\u003e\n\t\t\u003cconst name=\"CONFIGPATH\" value=\"./vendor/codeigniter4/framework/app/Config/\"/\u003e\n\t\t\u003cconst name=\"PUBLICPATH\" value=\"./vendor/codeigniter4/framework/public/\"/\u003e\n\t\t\u003cenv name=\"database.tests.hostname\" value=\"localhost\"/\u003e\n\t\t\u003cenv name=\"database.tests.database\" value=\"ci4_crud_test\"/\u003e\n\t\t\u003cenv name=\"database.tests.username\" value=\"root\"/\u003e\n\t\t\u003cenv name=\"database.tests.password\" value=\"\"/\u003e\n\t\t\u003cenv name=\"database.tests.DBDriver\" value=\"MySQLi\"/\u003e\n\t\t\u003cenv name=\"database.tests.DBPrefix\" value=\"\"/\u003e\n\t\u003c/php\u003e\n```\n\n\u003e Ensure that you use **different DB** for `testing`.\n\n\nAfter it, install the codeigniter and phpunit dependency:\n\n```bash\ncd /path/to/modules/ci4-album \u0026\u0026 composer install\n```\n\nLastly, run the test:\n\n```bash\nvendor/bin/phpunit\n````\n\nContributing\n------------\nContributions are very welcome. Please read [CONTRIBUTING.md](https://github.com/samsonasik/ci4-album/blob/master/CONTRIBUTING.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamsonasik%2Fci4-album","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsamsonasik%2Fci4-album","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamsonasik%2Fci4-album/lists"}