{"id":13609041,"url":"https://github.com/tattersoftware/codeigniter4-outbox","last_synced_at":"2025-04-12T15:10:39.770Z","repository":{"id":40659614,"uuid":"273817816","full_name":"tattersoftware/codeigniter4-outbox","owner":"tattersoftware","description":"Email toolkit for CodeIgniter 4","archived":false,"fork":false,"pushed_at":"2024-01-18T02:54:57.000Z","size":185,"stargazers_count":15,"open_issues_count":4,"forks_count":4,"subscribers_count":4,"default_branch":"develop","last_synced_at":"2024-05-01T09:41:11.169Z","etag":null,"topics":[],"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/tattersoftware.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":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-06-21T02:09:47.000Z","updated_at":"2024-06-21T03:30:08.140Z","dependencies_parsed_at":"2024-06-21T03:40:12.828Z","dependency_job_id":null,"html_url":"https://github.com/tattersoftware/codeigniter4-outbox","commit_stats":{"total_commits":68,"total_committers":1,"mean_commits":68.0,"dds":0.0,"last_synced_commit":"e1e823f6eb31b5eafc21c5169814315bb4b97380"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tattersoftware%2Fcodeigniter4-outbox","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tattersoftware%2Fcodeigniter4-outbox/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tattersoftware%2Fcodeigniter4-outbox/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tattersoftware%2Fcodeigniter4-outbox/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tattersoftware","download_url":"https://codeload.github.com/tattersoftware/codeigniter4-outbox/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248586231,"owners_count":21128997,"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":[],"created_at":"2024-08-01T19:01:32.000Z","updated_at":"2025-04-12T15:10:39.751Z","avatar_url":"https://github.com/tattersoftware.png","language":"PHP","funding_links":[],"categories":["PHP"],"sub_categories":[],"readme":"# Tatter\\Outbox\nEmail toolkit for CodeIgniter 4\n\n[![](https://github.com/tattersoftware/codeigniter4-outbox/workflows/PHPUnit/badge.svg)](https://github.com/tattersoftware/codeigniter4-outbox/actions/workflows/phpunit.yml)\n[![](https://github.com/tattersoftware/codeigniter4-outbox/workflows/PHPStan/badge.svg)](https://github.com/tattersoftware/codeigniter4-outbox/actions/workflows/phpstan.yml)\n[![](https://github.com/tattersoftware/codeigniter4-outbox/workflows/Deptrac/badge.svg)](https://github.com/tattersoftware/codeigniter4-outbox/actions/workflows/deptrac.yml)\n[![Coverage Status](https://coveralls.io/repos/github/tattersoftware/codeigniter4-outbox/badge.svg?branch=develop)](https://coveralls.io/github/tattersoftware/codeigniter4-outbox?branch=develop)\n\n## Quick Start\n\n1. Install with Composer: `\u003e composer require tatter/outbox`\n2. Prepare the database: `\u003e php spark migrate -all \u0026\u0026 php spark db:seed \"Tatter\\Outbox\\Database\\Seeds\\TemplateSeeder\"`\n3. Send beautiful, dynamic email:\n```php\nmodel(TemplateModel::class)-\u003efindByName('Default')\n\t-\u003eemail([\n\t\t'item' =\u003e 'Fancy Purse',\n\t\t'cost' =\u003e '10 dollars',\n\t\t'url'  =\u003e site_url('items/show/' . $itemId),\n\t])\n\t-\u003esetTo($user-\u003eemail)\n\t-\u003esend();\n```\n\n## Features\n\n**Outbox** supplies useful tools to supplement the framework's native `Email` class:\nlogging, style inlining, and templating.\n\n## Installation\n\nInstall easily via Composer to take advantage of CodeIgniter 4's autoloading capabilities\nand always be up-to-date:\n```shell\ncomposer require tatter/outbox\n```\n\nOr, install manually by downloading the source files and adding the directory to\n**app/Config/Autoload.php**.\n\n## Configuration (optional)\n\nThe library's default behavior can be altered by extending its config file. Copy\n**examples/Outbox.php** to **app/Config/** and follow the instructions\nin the comments. If no config file is found in **app/Config** then the library will use its own.\n\nIf you plan to use the Template Routes (see below) you might also want to configure\n[Tatter\\Layouts](https://github.com/tattersoftware/codeigniter4-layouts) to ensure the\nviews are displayed properly for your app.\n\n## Usage\n\n### Logging\n\nBy default **Outbox** will log any successfully sent emails in the database. This provides\na handy paper-trail for applications that send a variety of status and communication\nmessages to users. Use the `Tatter\\Outbox\\Models\\EmailModel` and its corresponding entity\nto view email logs.\n\n### Inlining\n\nSending HTML email can be tricky, as support for HTML and CSS vary across displays and devices.\n**Outbox** includes `CssToInlineStyles`, a module by *tijsverkoyen* to take any CSS and\ninject it inline into an email template for maximum compatibility. This allows you to reuse\nsite stylesheets or write your own from scratch and use them across any of your templates.\nUse the default styles from\n[Responsive HTML Email Template](https://github.com/leemunroe/responsive-html-email-template),\nsupply your own as string parameters, or create a View file and add it to the configuration.\n\n## Templating\n\n**Outbox** comes with a default template, a modified-for-CodeIgniter version of the\n[Responsive HTML Email Template](https://github.com/leemunroe/responsive-html-email-template).\nThis provides a solid basis for your emails so you can be sure they will display nicely on\nany device. Run the Template Seeder to begin using this as the default:\n```shell\n\tphp spark db:seed \"Tatter\\Outbox\\Database\\Seeds\\TemplateSeeder\"\n```\n\nYou may also write your own templates and seed them or use the provided MVC bundle for\nmanaging email templates in your database. To enable the Controller you will need to\ntoggle `$routeTemplates` in the configuration, or add the following routes to **app/Config/Routes.php**:\n\n```php\n// Routes to Email Templates\n$routes-\u003egroup('emails', ['namespace' =\u003e '\\Tatter\\Outbox\\Controllers'], function ($routes)\n{\n\t$routes-\u003eget('templates/new/(:segment)', 'Templates::new/$1');\n\t$routes-\u003eget('templates/send/(:segment)', 'Templates::send/$1');\n\t$routes-\u003epost('templates/send/(:segment)', 'Templates::send_commit/$1');\n\t$routes-\u003epresenter('templates', ['controller' =\u003e 'Templates']);\n});\n```\n\nBe sure to secure appropriate access to these routes (e.g. with a Filter).\n\n### Tokens\n\nTemplates use View Parser \"tokens\" that will be passed through to add your data.\nThe `Template` Entity can do this for you by passing in your data parameters:\n\n```php\n$template = model(TemplateModel::class)-\u003efindByName('Item Purchase');\n\n$subject = $template-\u003erenderSubject(['item' =\u003e 'Fancy Purse']);\n$body    = $template-\u003erenderBody(['cost' =\u003e '10 dollars']);\n```\n\n`renderBody()` will take care of inlining any CSS you have provided and including your\ntemplate in its parent (if defined).\n\nIf you do not need any other configuration you can get a fully prepared\nversion of the `Email` class with rendered and inlined content from the library:\n```php\n$email = $template-\u003eemail($data);\n$email-\u003esetTo('jill@example.com')-\u003esend();\n```\n\n### Cascading Templates\n\nEach `Template` may also be created with a \"Parent Template\". Parent templates need to have\na `{body}` token which will receive the parsed content from its child. Additional tokens\nin the parent template can be entered by defining them in the child.\n\nCascading templates makes it easy to have a few \"layouts\" with many different variable\nmessages for each layout. For example, your app may send both newsletters and receipts\nwith their own layout (Parent Template) and then a myriad of different customizable\nmessages for different occasions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftattersoftware%2Fcodeigniter4-outbox","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftattersoftware%2Fcodeigniter4-outbox","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftattersoftware%2Fcodeigniter4-outbox/lists"}