-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added more test coverage. * Added StyleCI * Fixed the Style * Refactored code and unit test. * Remove globals. * Minor refactor * Minor refactor * Minor refactor * Updated the PHPdocs * Changed the comment positioning * Update .scrutinizer.yml * Update .scrutinizer.yml * Removed scruitnizer and StyleCI * Added documentation * updated the documentation * updated the documentation * updated the documentation * updated the documentation * updated the documentation * updated the documentation * updated the documentation * updated the documentation * updated the documentation * Update Collection.md * Update Collection.md * Create ArrayHelper.md * Update Collection.md * Update index.md * Added Encrypter documentation. * Update composer.json * Documentation for StringHelper * Documentation for StringHelper * Updated the Collection. * Minor composer.json refactor. * Refactored the test. * Refactored the test and added more docs. * Added more docs * Added Mailgun transport and rest of the docs. * Fixed the link. * Fixed the link. * Merged master. * Merged master.
- Loading branch information
1 parent
2570192
commit ebdbe8d
Showing
18 changed files
with
742 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
# SwiftMailer Transports | ||
Back to [index](../index.md) | ||
|
||
- [Introduction](#introduction) | ||
- [Setup](#setup) | ||
- [Available Transport](#available-transport) | ||
|
||
<a name="introduction"></a> | ||
## Introduction | ||
Mailer transport allows user to use send email in different. | ||
|
||
**Please Note: This package contains SwifMailer transport it does not mean you will need to install SwiftMailer. You only need to install it if you want to use it.** | ||
|
||
_Almost all transports except MailTrapper transports are the ported from Laravel Framework you can find more information [here](https://laravel.com/docs/5.3/mail#introduction)._ | ||
|
||
<a name="available-transport"></a> | ||
## Available transports | ||
- [MailTrap](#mailtrap) | ||
- [Mailgun](#mailgun) | ||
- [Mandrill](#mandrill) | ||
- [AWS SES](#ses) | ||
- [Sparkpost](#spark) | ||
|
||
<a name="mailtrap"></a> | ||
### MailTrap | ||
Setup and usage | ||
|
||
$transport = (new \IdeasBucket\Common\Swiftmailer\Transport\Mailtrap) | ||
->setUsername('your username') | ||
->setPassword('your password'); | ||
$mailer = Swift_Mailer::newInstance($transport); | ||
|
||
// Create a message | ||
$message = Swift_Message::newInstance('Wonderful Subject') | ||
->setFrom(array('[email protected]' => 'John Doe')) | ||
->setTo(array('[email protected]', '[email protected]' => 'A name')) | ||
->setBody('Here is the message itself'); | ||
|
||
// Send the message | ||
$result = $mailer->send($message); | ||
|
||
<a name="mailgun"></a> | ||
### Mailgun | ||
|
||
*Requires Guzzle which can be installed using composer* | ||
|
||
composer require guzzlehttp/guzzle | ||
|
||
Setup and usage | ||
|
||
$transport = (new \IdeasBucket\Common\Swiftmailer\Transport\Mailgun(new GuzzleHttp\Client, 'YOUR API KEY', 'YOUR DOMAIN)); | ||
$mailer = Swift_Mailer::newInstance($transport); | ||
|
||
// Create a message | ||
$message = Swift_Message::newInstance('Wonderful Subject') | ||
->setFrom(array('[email protected]' => 'John Doe')) | ||
->setTo(array('[email protected]', '[email protected]' => 'A name')) | ||
->setBody('Here is the message itself'); | ||
|
||
// Send the message | ||
$result = $mailer->send($message); | ||
<a name="mandrill"></a> | ||
### Mandrill | ||
|
||
*Requires Guzzle which can be installed using composer* | ||
|
||
composer require guzzlehttp/guzzle | ||
|
||
Setup and usage | ||
|
||
$transport = (new \IdeasBucket\Common\Swiftmailer\Transport\Mandrill(new GuzzleHttp\Client, 'YOUR API KEY')); | ||
$mailer = Swift_Mailer::newInstance($transport); | ||
|
||
// Create a message | ||
$message = Swift_Message::newInstance('Wonderful Subject') | ||
->setFrom(array('[email protected]' => 'John Doe')) | ||
->setTo(array('[email protected]', '[email protected]' => 'A name')) | ||
->setBody('Here is the message itself'); | ||
|
||
// Send the message | ||
$result = $mailer->send($message); | ||
<a name="ses"></a> | ||
### AWS SES | ||
|
||
*To use the Amazon SES driver you must first install the Amazon AWS SDK for PHP. You may install this library by adding the following line to your `composer.json` file's `require` section and running the `composer update` command:* | ||
|
||
"aws/aws-sdk-php": "~3.0" | ||
|
||
Setup and usage | ||
|
||
use Aws\Ses\SesClient; | ||
|
||
$client = SesClient::factory([ | ||
'profile' => '<profile in your aws credentials file>', | ||
'region' => '<region name>' | ||
]); | ||
|
||
$transport = (new \IdeasBucket\Common\Swiftmailer\Transport\Ses($client); | ||
$mailer = Swift_Mailer::newInstance($transport); | ||
|
||
// Create a message | ||
$message = Swift_Message::newInstance('Wonderful Subject') | ||
->setFrom(array('[email protected]' => 'John Doe')) | ||
->setTo(array('[email protected]', '[email protected]' => 'A name')) | ||
->setBody('Here is the message itself'); | ||
|
||
// Send the message | ||
$result = $mailer->send($message); | ||
<a name="sparkpost"></a> | ||
### SparkPost | ||
|
||
*Requires Guzzle which can be installed using composer* | ||
|
||
composer require guzzlehttp/guzzle | ||
|
||
Setup and usage | ||
|
||
$transport = (new \IdeasBucket\Common\Swiftmailer\Transport\SparkPost(new GuzzleHttp\Client, 'YOUR API KEY')); | ||
$mailer = Swift_Mailer::newInstance($transport); | ||
|
||
// Create a message | ||
$message = Swift_Message::newInstance('Wonderful Subject') | ||
->setFrom(array('[email protected]' => 'John Doe')) | ||
->setTo(array('[email protected]', '[email protected]' => 'A name')) | ||
->setBody('Here is the message itself'); | ||
|
||
// Send the message | ||
$result = $mailer->send($message); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# Extension | ||
Back to [index](../index.md) | ||
|
||
- [Introduction](#introduction) | ||
- [Setup](#setup) | ||
- [Available Filters](#available-filters) | ||
|
||
<a name="introduction"></a> | ||
## Introduction | ||
This Twig extension provides several filters that can be used in Twig template. | ||
|
||
**Please Note: This package contains Twig extension it does not mean you will need to install Twig. You only need to install it if you want to use it.** | ||
|
||
<a name="setup"></a> | ||
## Setup | ||
$twig = new Twig_Environment($loader); | ||
$twig->addExtension(new \IdeasBucket\Common\Twig\Extension); | ||
|
||
<a name="available-filters"></a> | ||
## Available Filters | ||
- [bin2hex](#bin2hex) | ||
- [slug](#slug) | ||
- [md5](#md5) | ||
|
||
<a name="bin2hex"></a> | ||
### bin2hex | ||
Returns an ASCII string containing the hexadecimal representation of str. The conversion is done byte-wise with the high-nibble first. | ||
|
||
Usage {{ test|bin2hex }} | ||
|
||
// Outputs | ||
74657374 | ||
|
||
<a name="slug"></a> | ||
### slug | ||
Returns normalized version of string that can be use as index that is easy to remember. Requires **php_intl** extension. | ||
|
||
Usage {{ Hello World|slug }} | ||
|
||
// Outputs - By default uses - as separator and converts to lower case. | ||
hello-world | ||
|
||
Usage {{ Hello World|slug(false, '_') }} | ||
|
||
// Outputs - Using different separator and no string coversion | ||
Hello_World | ||
|
||
<a name="md5"></a> | ||
### md5 | ||
Returns md5 hash of a input | ||
|
||
Usage {{ Hello World|md5 }} | ||
|
||
// Outputs | ||
b10a8db164e0754105b7a99be72e3fe5 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
# ArrayToXml | ||
Back to [index](../index.md) | ||
|
||
- [Introduction](#introduction) | ||
- [Available Methods](#available-methods) | ||
|
||
<a name="introduction"></a> | ||
## Introduction | ||
#### This class is inspired by work of [Lalit Lab](http://www.lalit.org/lab/convert-xml-to-array-in-php-xml2array/) | ||
The `IdeasBucket\Common\Utils\ArrayToXml` class provides method that can convert array into XML. | ||
|
||
<a name="available-methods"></a> | ||
## Available Methods | ||
* [createXml](#create-xml) | ||
* [getXmlString](#get-xml-string) | ||
|
||
<a name="create-xml"></a> | ||
#### `createXml()` | ||
The `createXml` method coverts the given Array to DOMDocument. | ||
|
||
$nest = ['type' => 'test', 'nest' => [ | ||
'nest' => [ | ||
'nest' => [ | ||
'@attributes' => [ | ||
'prop1' => 'aloha', | ||
'prop2' => 'hello', | ||
'prop3' => 'ke cha', | ||
], | ||
'nest' => [ | ||
'@attributes' => [ | ||
'prop1' => 'bazingaaa!!!!', | ||
], | ||
], | ||
], | ||
], | ||
]]; | ||
|
||
ArrayToXml::createXml('test', $nest); // Will return \DOMDocument | ||
OR | ||
ArrayToXml::createXml('test', $nest, 'UTF-8') // Will return \DOMDocument | ||
|
||
// Will produce \DOMDocument instace with following content. | ||
// <?xml version="1.0" encoding="UTF-8"?> | ||
// <test> | ||
// <type>test</type> | ||
// <nest> | ||
// <nest> | ||
// <nest prop1="aloha" prop2="hello" prop3="ke cha"> | ||
// <nest prop1="bazingaaa!!!!"/> | ||
// </nest> | ||
// </nest> | ||
// </nest> | ||
// </test> | ||
|
||
<a name="get-xml-string"></a> | ||
#### `getXmlString()` | ||
The `getXmlString` method coverts the given Array to string. | ||
|
||
$nest = ['type' => 'test', 'nest' => [ | ||
'nest' => [ | ||
'nest' => [ | ||
'@attributes' => [ | ||
'prop1' => 'aloha', | ||
'prop2' => 'hello', | ||
'prop3' => 'ke cha', | ||
], | ||
'nest' => [ | ||
'@attributes' => [ | ||
'prop1' => 'bazingaaa!!!!', | ||
], | ||
], | ||
], | ||
], | ||
]]; | ||
|
||
ArrayToXml::getXmlString'test', $nest); // Will return string | ||
OR | ||
ArrayToXml::getXmlString('test', $nest, 'UTF-8') // Will return string | ||
|
||
// Will produce string instace with following content. | ||
// <?xml version="1.0" encoding="UTF-8"?> | ||
// <test> | ||
// <type>test</type> | ||
// <nest> | ||
// <nest> | ||
// <nest prop1="aloha" prop2="hello" prop3="ke cha"> | ||
// <nest prop1="bazingaaa!!!!"/> | ||
// </nest> | ||
// </nest> | ||
// </nest> | ||
// </test> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# XmlToArray | ||
Back to [index](../index.md) | ||
|
||
- [Introduction](#introduction) | ||
- [Available Methods](#available-methods) | ||
|
||
<a name="introduction"></a> | ||
## Introduction | ||
#### This class is inspired by work of [Lalit Lab](http://www.lalit.org/lab/convert-xml-to-array-in-php-xml2array/) | ||
The `IdeasBucket\Common\Utils\XmlToArray` class provides method that can convert XML into plain PHP array. | ||
|
||
<a name="available-methods"></a> | ||
## Available Methods | ||
* [createArray](#create-array) | ||
|
||
<a name="create-array"></a> | ||
#### `createArray()` | ||
The `createArray` method coverts the given XML to Array. | ||
|
||
XmlToArray::createArray('<a version="1.0"><b><c><f name="test">ererf</f></c></b></a>'); | ||
|
||
// Will produce array like this. | ||
// Array | ||
// ( | ||
// [a] => Array | ||
// ( | ||
// [b] => Array | ||
// ( | ||
// [c] => Array | ||
// ( | ||
// [f] => Array | ||
// ( | ||
// [@value] => ererf | ||
// [@attributes] => Array | ||
// ( | ||
// [name] => test | ||
// ) | ||
// | ||
// ) | ||
// | ||
// ) | ||
// | ||
// ) | ||
// | ||
// [@attributes] => Array | ||
// ( | ||
// [version] => 1.0 | ||
// ) | ||
// | ||
// ) | ||
// | ||
// ) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,12 @@ | ||
# Documentation | ||
* Utils | ||
* [ArrayHelper](Utils/ArrayHelper.md) | ||
* ArrayToXml | ||
* [ArrayToXml](Utils/ArrayToXml.md) | ||
* [Collection](Utils/Collection.md) | ||
* [Encrypter](Utils/Encrypter.md) | ||
* [StringHelper](Utils/StringHelper.md) | ||
* XmlToArray | ||
|
||
* [XmlToArray](Utils/XmlToArray.md) | ||
* Twig | ||
* [Extension](Utils/Extension.md) | ||
* SwiftMailer | ||
* [Transports](Swiftmailer/Transports.md) |
Oops, something went wrong.