Skip to content

Commit

Permalink
Merge pull request #789 from spiral/hotfix/composer
Browse files Browse the repository at this point in the history
  • Loading branch information
spiralbot committed Sep 13, 2022
1 parent 58b23f0 commit cce9e01
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 127 deletions.
39 changes: 0 additions & 39 deletions .github/workflows/main.yml

This file was deleted.

15 changes: 15 additions & 0 deletions .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
on:
push:
branches:
- master

name: phpunit

jobs:
phpunit:
uses: spiral/gh-actions/.github/workflows/phpunit.yml@master
with:
os: >-
['ubuntu-latest']
php: >-
['8.1']
15 changes: 15 additions & 0 deletions .github/workflows/psalm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
on:
push:
branches:
- master

name: static analysis

jobs:
psalm:
uses: spiral/gh-actions/.github/workflows/psalm.yml@master
with:
os: >-
['ubuntu-latest']
php: >-
['8.1']
95 changes: 9 additions & 86 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,91 +1,14 @@
SendIt
========
[![Latest Stable Version](https://poser.pugx.org/spiral/sendit/v/stable)](https://packagist.org/packages/spiral/sendit)
[![Build Status](https://github.com/spiral/sendit/workflows/build/badge.svg)](https://github.com/spiral/sendit/actions)
[![Codecov](https://codecov.io/gh/spiral/sendit/branch/master/graph/badge.svg)](https://codecov.io/gh/spiral/sendit/)

Email builder and queue handler.

Installation:
--------
To install the component:

```bash
$ composer require spiral/sendit
```

> Make sure to install required `symfony/mailer` drivers.
Activate the component bootloaders:

```php
use Spiral\SendIt\Bootloader as Sendit;
// ...

protected const LOAD = [
// ...
Sendit\MailerBootloader::class,
Sendit\BuilderBootloader::class,
// ...
];
```

Configure the component using `app/config/mailer.php` file:
# Spiral Framework: SendIt

```php
// Amazon SES
return [
'dsn' => sprintf(
'ses+smtps://%s:%s@ses?region=%s',
rawurlencode(env('AWS_KEY')),
rawurlencode(env('AWS_SECRET')),
env('AWS_REGION')
),
'from' => 'Project Name <no-reply@project.com>',
];
```

Or specify ENV variables:

```dotenv
MAILER_DSN = "smtp://..."
MAILER_FROM = "Project Name <no-reply@project.com>"
```

Example:
--------
The component provides the ability to compose content-rich email templates using Stempler views:

```html
<extends:sendit:builder subject="I'm afraid I can't do that"/>
<use:bundle path="sendit:bundle"/>

<email:attach path="{{ $attachment }}" name="attachment.txt"/>

<block:html>
<p>I'm sorry, {{ $name }}!</p>
<p><email:image path="path/to/image.png"/></p>
</block:html>
```

To use:
[![PHP Version Require](https://poser.pugx.org/spiral/sendit/require/php)](https://packagist.org/packages/spiral/sendit)
[![Latest Stable Version](https://poser.pugx.org/spiral/sendit/v/stable)](https://packagist.org/packages/spiral/sendit)
[![phpunit](https://github.com/spiral/sendit/workflows/phpunit/badge.svg)](https://github.com/spiral/sendit/actions)
[![psalm](https://github.com/spiral/sendit/workflows/psalm/badge.svg)](https://github.com/spiral/sendit/actions)
[![Codecov](https://codecov.io/gh/spiral/sendit/branch/master/graph/badge.svg)](https://codecov.io/gh/spiral/sendit/)
[![Total Downloads](https://poser.pugx.org/spiral/sendit/downloads)](https://packagist.org/packages/spiral/sendit)

```php
use Spiral\Mailer;
<b>[Documentation](https://spiral.dev/docs/component-sendit)</b> | [Framework Bundle](https://github.com/spiral/framework)

function send(Mailer\MailerInterface $mailer)
{
$mailer->send(new Mailer\Message(
"template.dark.php",
"email@domain.com",
[
"name" => "Dave",
"attachment" => __FILE__,
]
));
}
```
## License:

License:
--------
MIT License (MIT). Please see [`LICENSE`](./LICENSE) for more information. Maintained by [Spiral Scout](https://spiralscout.com).
5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@
"phpunit/phpunit": "^9.5.20",
"mockery/mockery": "^1.5",
"spiral/boot": "^3.0",
"spiral/stempler-bridge": "^3.0"
"spiral/stempler-bridge": "^3.0",
"vimeo/psalm": "^4.27"
},
"autoload": {
"psr-4": {
Expand All @@ -55,7 +56,7 @@
},
"extra": {
"branch-alias": {
"dev-master": "2.14.x-dev"
"dev-master": "3.0.x-dev"
}
},
"config": {
Expand Down
18 changes: 18 additions & 0 deletions psalm.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0"?>
<psalm
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"

errorLevel="4"
hoistConstants="true"
resolveFromConfigFile="true"
findUnusedPsalmSuppress="true"
findUnusedVariablesAndParams="true"
ensureArrayStringOffsetsExist="true"
addParamDefaultToDocblockType="true"
>
<projectFiles>
<directory name="src" />
</projectFiles>
</psalm>

0 comments on commit cce9e01

Please sign in to comment.