├── .gitignore
├── example.png
├── src
├── General
│ ├── Exceptions
│ │ └── InvalidUrlException.php
│ ├── SerializeToString.php
│ └── Url.php
├── Slack
│ ├── Exceptions
│ │ ├── InvalidColourException.php
│ │ ├── InvalidEmojiException.php
│ │ └── InvalidChannelException.php
│ ├── Interfaces
│ │ ├── ChannelInterface.php
│ │ ├── UsernameInterface.php
│ │ ├── ConfigInterface.php
│ │ ├── UserInterface.php
│ │ ├── IconInterface.php
│ │ └── WebhookInterface.php
│ ├── UrlIcon.php
│ ├── Username.php
│ ├── Config.php
│ ├── Attachment
│ │ ├── Field.php
│ │ ├── Title.php
│ │ ├── ParametersAttachment.php
│ │ ├── Author.php
│ │ ├── Colour.php
│ │ ├── TraceAttachment.php
│ │ ├── BasicInfoAttachment.php
│ │ └── Attachment.php
│ ├── User.php
│ ├── Channel.php
│ ├── EmojiIcon.php
│ ├── Webhook.php
│ ├── StringFormat.php
│ └── Payload.php
└── Monolog
│ ├── Exceptions
│ └── InvalidLoggerLevelException.php
│ ├── Interfaces
│ ├── ConfigInterface.php
│ └── ErrorInterface.php
│ ├── Config.php
│ ├── SlackWebhookHandler.php
│ └── Error.php
├── tests
└── Unit
│ ├── Monolog
│ ├── Mocks
│ │ └── CurlUtil.php
│ ├── ConfigTest.php
│ ├── SlackWebhookHandlerTest.php
│ └── ErrorTest.php
│ ├── Slack
│ ├── Attachment
│ │ ├── TitleTest.php
│ │ ├── FieldTest.php
│ │ ├── AuthorTest.php
│ │ ├── ColourTest.php
│ │ ├── BasicInfoAttachmentTest.php
│ │ └── AttachmentTest.php
│ ├── ConfigTest.php
│ ├── UserTest.php
│ ├── UrlIconTest.php
│ ├── UsernameTest.php
│ ├── EmojiIconTest.php
│ ├── StringFormatTest.php
│ ├── WebhookTest.php
│ ├── PayloadTest.php
│ └── ChannelTest.php
│ └── General
│ └── UrlTest.php
├── phpunit.xml.dist
├── .travis.yml
├── composer.json
├── README.md
├── CHANGELOG.md
├── LICENSE
└── composer.lock
/.gitignore:
--------------------------------------------------------------------------------
1 | vendor/*
2 | index.php
3 |
--------------------------------------------------------------------------------
/example.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pageon/SlackWebhookMonolog/master/example.png
--------------------------------------------------------------------------------
/src/General/Exceptions/InvalidUrlException.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * @since 0.4.0
11 | */
12 | class InvalidUrlException extends InvalidArgumentException
13 | {
14 | }
15 |
--------------------------------------------------------------------------------
/src/Slack/Exceptions/InvalidColourException.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * @since 0.1.0
11 | */
12 | class InvalidColourException extends InvalidArgumentException
13 | {
14 | }
15 |
--------------------------------------------------------------------------------
/src/Slack/Exceptions/InvalidEmojiException.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * @since 0.1.0
11 | */
12 | class InvalidEmojiException extends InvalidArgumentException
13 | {
14 | }
15 |
--------------------------------------------------------------------------------
/src/Slack/Exceptions/InvalidChannelException.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * @since 0.1.0
11 | */
12 | class InvalidChannelException extends InvalidArgumentException
13 | {
14 | }
15 |
--------------------------------------------------------------------------------
/src/Monolog/Exceptions/InvalidLoggerLevelException.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * @since 0.1.0
11 | */
12 | class InvalidLoggerLevelException extends InvalidArgumentException
13 | {
14 | }
15 |
--------------------------------------------------------------------------------
/src/General/SerializeToString.php:
--------------------------------------------------------------------------------
1 |
11 | *
12 | * @since 0.4.0
13 | */
14 | abstract class SerializeToString implements JsonSerializable
15 | {
16 | /**
17 | * {@inheritdoc}
18 | */
19 | public function jsonSerialize()
20 | {
21 | return (string) $this;
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/Monolog/Interfaces/ConfigInterface.php:
--------------------------------------------------------------------------------
1 |
7 | *
8 | * @since 0.1.0
9 | */
10 | interface ConfigInterface
11 | {
12 | /**
13 | * The minimum logging level at which this handler will be triggered.
14 | *
15 | * @return int
16 | */
17 | public function getLevel();
18 |
19 | /**
20 | * Whether the messages that are handled can bubble up the stack or not.
21 | *
22 | * @return bool
23 | */
24 | public function doesBubble();
25 | }
26 |
--------------------------------------------------------------------------------
/src/Slack/Interfaces/ChannelInterface.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * @since 0.1.0
11 | */
12 | interface ChannelInterface extends JsonSerializable
13 | {
14 | /**
15 | * Returns the channel.
16 | *
17 | * @return string
18 | */
19 | public function getChannel();
20 |
21 | /**
22 | * The string representation of the Channel class should match the channel.
23 | *
24 | * @return string
25 | */
26 | public function __toString();
27 | }
28 |
--------------------------------------------------------------------------------
/src/Slack/Interfaces/UsernameInterface.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * @since 0.1.0
11 | */
12 | interface UsernameInterface extends JsonSerializable
13 | {
14 | /**
15 | * Returns the username.
16 | *
17 | * @return string
18 | */
19 | public function getUsername();
20 |
21 | /**
22 | * The string representation of the username class should match the username.
23 | *
24 | * @return string
25 | */
26 | public function __toString();
27 | }
28 |
--------------------------------------------------------------------------------
/src/Slack/UrlIcon.php:
--------------------------------------------------------------------------------
1 |
10 | *
11 | * @since 0.1.0
12 | */
13 | class UrlIcon extends Url implements IconInterface
14 | {
15 | /**
16 | * {@inheritdoc}
17 | */
18 | public function getIcon()
19 | {
20 | return $this->getUrl();
21 | }
22 |
23 | /**
24 | * {@inheritdoc}
25 | */
26 | public function getType()
27 | {
28 | return 'url';
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/tests/Unit/Monolog/Mocks/CurlUtil.php:
--------------------------------------------------------------------------------
1 |
11 | */
12 | class CurlUtil extends Util
13 | {
14 | /**
15 | * @param resource $ch
16 | * @param int $retries
17 | * @param bool $closeAfterDone
18 | *
19 | * @return resource
20 | */
21 | public static function execute($ch, $retries = 5, $closeAfterDone = true)
22 | {
23 | // do nothing here since we don't want to send a http request in our tests.
24 | return $ch;
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/Slack/Interfaces/ConfigInterface.php:
--------------------------------------------------------------------------------
1 |
7 | *
8 | * @since 0.1.0
9 | */
10 | interface ConfigInterface
11 | {
12 | /**
13 | * @return WebhookInterface
14 | */
15 | public function getWebhook();
16 |
17 | /**
18 | * If there is a user this will override the default configuration from Slack.
19 | *
20 | * @return UserInterface|null
21 | */
22 | public function getCustomUser();
23 |
24 | /**
25 | * This will return true if there is a user.
26 | *
27 | * @return bool
28 | */
29 | public function hasCustomUser();
30 | }
31 |
--------------------------------------------------------------------------------
/phpunit.xml.dist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
11 |
12 |
13 | tests/Unit
14 |
15 |
16 |
17 |
18 |
19 | src
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/src/Slack/Interfaces/UserInterface.php:
--------------------------------------------------------------------------------
1 |
7 | *
8 | * @since 0.1.0
9 | */
10 | interface UserInterface
11 | {
12 | /**
13 | * @return UsernameInterface|null
14 | */
15 | public function getUsername();
16 |
17 | /**
18 | * Returns whether there is a custom Username.
19 | *
20 | * @return bool
21 | */
22 | public function hasUsername();
23 |
24 | /**
25 | * @return IconInterface|null
26 | */
27 | public function getIcon();
28 |
29 | /**
30 | * Returns whether there is a custom Icon.
31 | *
32 | * @return bool
33 | */
34 | public function hasIcon();
35 | }
36 |
--------------------------------------------------------------------------------
/src/Slack/Interfaces/IconInterface.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * @since 0.1.0
11 | */
12 | interface IconInterface extends JsonSerializable
13 | {
14 | /**
15 | * Returns the icon.
16 | *
17 | * @return string
18 | */
19 | public function getIcon();
20 |
21 | /**
22 | * Returns the name of the type i.e. "emoji".
23 | *
24 | * @return string
25 | */
26 | public function getType();
27 |
28 | /**
29 | * When the class is cast to a string it should return the name of the icon.
30 | *
31 | * @return string
32 | */
33 | public function __toString();
34 | }
35 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: php
2 |
3 | matrix:
4 | include:
5 | - php: 5.3
6 | - php: 5.4
7 | - php: 5.5
8 | - php: 5.6
9 | - php: 7
10 | - php: hhvm
11 | allow_failures:
12 | - php: 5.3
13 | - php: hhvm
14 |
15 | script:
16 | - phpunit --coverage-clover=coverage.clover
17 |
18 | before_script:
19 | - composer install
20 |
21 | after_success:
22 | - if [[ "$TRAVIS_PHP_VERSION" != "hhvm" ]] && [[ "$TRAVIS_PHP_VERSION" != "7" ]]; then wget https://scrutinizer-ci.com/ocular.phar; fi
23 | - if [[ "$TRAVIS_PHP_VERSION" != "hhvm" ]] && [[ "$TRAVIS_PHP_VERSION" != "7" ]]; then php ocular.phar code-coverage:upload --format=php-clover coverage.clover; fi
24 |
25 | sudo: false
26 |
27 | notifications:
28 | email:
29 | jelmer@pageon.be
30 |
--------------------------------------------------------------------------------
/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "pageon/slack-webhook-monolog",
3 | "description": "A monolog handler for slack integration using webhooks",
4 | "keywords": [
5 | "monolog",
6 | "slack",
7 | "webhook"
8 | ],
9 | "minimum-stability": "stable",
10 | "license": "GPL3",
11 | "authors": [
12 | {
13 | "name": "Jelmer Prins",
14 | "email": "jelmer@pageon.be"
15 | }
16 | ],
17 | "autoload": {
18 | "psr-4": {
19 | "Pageon\\SlackWebhookMonolog\\": "src/"
20 | }
21 | },
22 | "autoload-dev": {
23 | "psr-4": {
24 | "Pageon\\SlackWebhookMonolog\\Tests\\": "tests/"
25 | }
26 | },
27 | "require": {
28 | "monolog/monolog": "^1.12",
29 | "ext-curl": "*"
30 | },
31 | "require-dev": {
32 | "phpunit/phpunit": "^4.8"
33 | },
34 | "config": {
35 | "platform": {"php": "5.4"},
36 | "sort-packages": true
37 | },
38 | "prefer-stable": true
39 | }
40 |
--------------------------------------------------------------------------------
/tests/Unit/Slack/Attachment/TitleTest.php:
--------------------------------------------------------------------------------
1 | assertEquals($title, (new Title($title))->getTitle());
15 | $this->assertEquals($title, (string) new Title($title));
16 | }
17 |
18 | public function testHasLink()
19 | {
20 | $this->assertTrue((new Title('bob', new Url('http://pageon.be')))->hasLink());
21 | $this->assertFalse((new Title('bob'))->hasLink());
22 | }
23 |
24 | public function testLink()
25 | {
26 | $link = new Url('http://pageon.be');
27 | $this->assertEquals($link, (new Title('bob', $link))->getLink());
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/tests/Unit/Slack/Attachment/FieldTest.php:
--------------------------------------------------------------------------------
1 | assertEquals(
15 | '{"title":"pilot","value":"Han Solo","short":false}',
16 | json_encode(new Field('pilot', 'Han Solo'))
17 | );
18 | $this->assertEquals(
19 | '{"title":"pilot","value":"Han Solo","short":false}',
20 | json_encode(new Field('pilot', 'Han Solo', false))
21 | );
22 | $this->assertEquals(
23 | '{"title":"pilot","value":"Han Solo","short":true}',
24 | json_encode(new Field('pilot', 'Han Solo', true))
25 | );
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/Slack/Interfaces/WebhookInterface.php:
--------------------------------------------------------------------------------
1 |
7 | *
8 | * @since 0.1.0
9 | */
10 | interface WebhookInterface
11 | {
12 | /**
13 | * The url provided by slack when creating a webhook.
14 | *
15 | * @return string
16 | */
17 | public function getUrl();
18 |
19 | /**
20 | * A custom channel that will override the default set in the config on slack.
21 | *
22 | * @return ChannelInterface
23 | */
24 | public function getCustomChannel();
25 |
26 | /**
27 | * This will return true if there is a custom channel that will override the default set in the config on slack.
28 | *
29 | * @return bool
30 | */
31 | public function hasCustomChannel();
32 |
33 | /**
34 | * The to string representation of the webhook should return the url of the webhook.
35 | *
36 | * @return string
37 | */
38 | public function __toString();
39 | }
40 |
--------------------------------------------------------------------------------
/src/Monolog/Interfaces/ErrorInterface.php:
--------------------------------------------------------------------------------
1 |
9 | */
10 | interface ErrorInterface
11 | {
12 | /**
13 | * The filename that the error was raised in.
14 | *
15 | * @return string
16 | */
17 | public function getFile();
18 |
19 | /**
20 | * The line number the error was raised at.
21 | *
22 | * @return int
23 | */
24 | public function getLine();
25 |
26 | /**
27 | * The error message.
28 | *
29 | * @return string
30 | */
31 | public function getMessage();
32 |
33 | /**
34 | * Contains an array of variables that existed in the scope the error was triggered in.
35 | *
36 | * @return array
37 | */
38 | public function getParameters();
39 |
40 | /**
41 | * Contents of debug_backtrace().
42 | *
43 | * @return array
44 | */
45 | public function getTrace();
46 | }
47 |
--------------------------------------------------------------------------------
/src/Slack/Username.php:
--------------------------------------------------------------------------------
1 |
10 | *
11 | * @since 0.1.0
12 | */
13 | class Username extends SerializeToString implements UsernameInterface
14 | {
15 | /**
16 | * @var string
17 | */
18 | private $username;
19 |
20 | /**
21 | * Username constructor.
22 | *
23 | * @param string $username
24 | */
25 | public function __construct($username)
26 | {
27 | $this->setUsername($username);
28 | }
29 |
30 | /**
31 | * {@inheritdoc}
32 | */
33 | public function getUsername()
34 | {
35 | return $this->username;
36 | }
37 |
38 | /**
39 | * @param string $username
40 | *
41 | * @return self
42 | */
43 | private function setUsername($username)
44 | {
45 | $this->username = trim($username);
46 |
47 | return $this;
48 | }
49 |
50 | /**
51 | * {@inheritdoc}
52 | */
53 | public function __toString()
54 | {
55 | return $this->getUsername();
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/src/Slack/Config.php:
--------------------------------------------------------------------------------
1 |
11 | *
12 | * @since 0.1.0
13 | */
14 | class Config implements ConfigInterface
15 | {
16 | /**
17 | * @var WebhookInterface the configuration for the webhook
18 | */
19 | private $webhook;
20 |
21 | /**
22 | * If not available the default config from slack will be used.
23 | *
24 | * @var UserInterface|null The configuration for the presentation of the webhook user.
25 | */
26 | private $customUser;
27 |
28 | /**
29 | * Config constructor.
30 | *
31 | * @param WebhookInterface $webhook
32 | * @param UserInterface|null $customUser
33 | */
34 | public function __construct(WebhookInterface $webhook, UserInterface $customUser = null)
35 | {
36 | $this->webhook = $webhook;
37 | $this->customUser = $customUser;
38 | }
39 |
40 | /**
41 | * {@inheritdoc}
42 | */
43 | public function getWebhook()
44 | {
45 | return $this->webhook;
46 | }
47 |
48 | /**
49 | * {@inheritdoc}
50 | */
51 | public function getCustomUser()
52 | {
53 | return $this->customUser;
54 | }
55 |
56 | /**
57 | * {@inheritdoc}
58 | */
59 | public function hasCustomUser()
60 | {
61 | return $this->customUser !== null;
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # SlackWebhookMonolog
2 | [](https://travis-ci.org/Pageon/SlackWebhookMonolog)
3 | [](https://packagist.org/packages/pageon/slack-webhook-monolog)
4 | [](https://packagist.org/packages/pageon/slack-webhook-monolog)
5 | [](https://packagist.org/packages/pageon/slack-webhook-monolog)
6 | [](https://scrutinizer-ci.com/g/Pageon/SlackWebhookMonolog/?branch=master)
7 | [](https://scrutinizer-ci.com/g/Pageon/SlackWebhookMonolog/?branch=master)
8 | [](https://styleci.io/repos/50748390)
9 |
10 | In monolog there is already a slack integration using the api but that takes up an integration slot.
11 | If you are on the free plan you only have limited integration slots (10).
12 | In order to be able to use slack for monolog I implemented it using webhooks.
13 |
14 | ## Usage
15 |
16 | As simple as pushing your `\Pageon\SlackWebhookMonolog\Monolog\SlackWebhookHandler` as a handler to Monolog
17 |
18 | For an example of an implementation see [implementation example](https://github.com/Pageon/pageon-fork-config)
19 |
20 | ## Example of message in Slack
21 | 
22 |
--------------------------------------------------------------------------------
/tests/Unit/Slack/Attachment/AuthorTest.php:
--------------------------------------------------------------------------------
1 | assertEquals($name, $author->getName());
18 | $this->assertEquals($name, (string) $author);
19 | $this->assertEquals('"' . $name . '"', json_encode($author));
20 | }
21 |
22 | public function testLink()
23 | {
24 | $authorNoLink = new Author('J.R.R. Tolkien');
25 | $this->assertFalse($authorNoLink->hasLink());
26 |
27 | $link = new Url('https://en.wikipedia.org/wiki/George_Orwell');
28 | $authorLink = new Author('George Orwell', $link);
29 | $this->assertTrue($authorLink->hasLink());
30 | $this->assertEquals($link, $authorLink->getLink());
31 | }
32 |
33 | public function testIcon()
34 | {
35 | $authorNoIcon = new Author('J.R.R. Tolkien');
36 | $this->assertFalse($authorNoIcon->hasIcon());
37 |
38 | $icon = new Url('https://upload.wikimedia.org/wikipedia/commons/7/7e/George_Orwell_press_photo.jpg');
39 | $authorIcon = new Author('George Orwell', null, $icon);
40 | $this->assertTrue($authorIcon->hasIcon());
41 | $this->assertEquals($icon, $authorIcon->getIcon());
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/src/Slack/Attachment/Field.php:
--------------------------------------------------------------------------------
1 |
11 | *
12 | * @since 0.4.0
13 | */
14 | final class Field implements JsonSerializable
15 | {
16 | /**
17 | * Shown as a bold heading above the value text.
18 | * It cannot contain markup and will be escaped for you.
19 | *
20 | * @var string
21 | */
22 | private $title;
23 |
24 | /**
25 | * The text value of the field.
26 | * It may contain standard message markup and must be escaped as normal.
27 | * May be multi-line.
28 | *
29 | * @var string
30 | */
31 | private $value;
32 |
33 | /**
34 | * An optional flag indicating whether the value is short enough to be displayed side-by-side with other values.
35 | *
36 | * @var bool
37 | */
38 | private $short;
39 |
40 | /**
41 | * AttachmentField constructor.
42 | *
43 | * @param string $title
44 | * @param string $value
45 | * @param bool $short
46 | */
47 | public function __construct($title, $value, $short = false)
48 | {
49 | $this->title = $title;
50 | $this->value = $value;
51 | $this->short = $short;
52 | }
53 |
54 | /**
55 | * {@inheritdoc}
56 | */
57 | public function jsonSerialize()
58 | {
59 | return [
60 | 'title' => $this->title,
61 | 'value' => $this->value,
62 | 'short' => $this->short,
63 | ];
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/src/Slack/User.php:
--------------------------------------------------------------------------------
1 |
11 | *
12 | * @since 0.1.0
13 | */
14 | class User implements UserInterface
15 | {
16 | /**
17 | * @var UsernameInterface|null
18 | */
19 | private $username = null;
20 |
21 | /**
22 | * @var IconInterface|null
23 | */
24 | private $icon = null;
25 |
26 | /**
27 | * Setting a custom Username or Icon is not required.
28 | * If they are not provided slack will fallback to the default settings from the configuration in slack.
29 | *
30 | * @param UsernameInterface|null $username
31 | * @param IconInterface|null $icon
32 | */
33 | public function __construct(UsernameInterface $username = null, IconInterface $icon = null)
34 | {
35 | $this->username = $username;
36 | $this->icon = $icon;
37 | }
38 |
39 | /**
40 | * {@inheritdoc}
41 | */
42 | public function getUsername()
43 | {
44 | return $this->username;
45 | }
46 |
47 | /**
48 | * {@inheritdoc}
49 | */
50 | public function hasUsername()
51 | {
52 | return $this->username !== null;
53 | }
54 |
55 | /**
56 | * {@inheritdoc}
57 | */
58 | public function getIcon()
59 | {
60 | return $this->icon;
61 | }
62 |
63 | /**
64 | * {@inheritdoc}
65 | */
66 | public function hasIcon()
67 | {
68 | return $this->icon !== null;
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/src/Slack/Attachment/Title.php:
--------------------------------------------------------------------------------
1 |
13 | *
14 | * @since 0.4.0
15 | */
16 | final class Title extends SerializeToString
17 | {
18 | /**
19 | * The title is displayed as larger, bold text near the top of a message attachment.
20 | *
21 | * @var string
22 | */
23 | private $title;
24 |
25 | /**
26 | * By passing a valid URL in the link parameter (optional), the title text will be hyperlinked.
27 | *
28 | * @var Url|null
29 | */
30 | private $link;
31 |
32 | /**
33 | * @param string $title
34 | * @param Url|null $link
35 | */
36 | public function __construct($title, Url $link = null)
37 | {
38 | $this->title = $title;
39 | $this->link = $link;
40 | }
41 |
42 | /**
43 | * @return string
44 | */
45 | public function getTitle()
46 | {
47 | return $this->title;
48 | }
49 |
50 | /**
51 | * @return bool
52 | */
53 | public function hasLink()
54 | {
55 | return $this->link !== null;
56 | }
57 |
58 | /**
59 | * @return Url|null
60 | */
61 | public function getLink()
62 | {
63 | return $this->link;
64 | }
65 |
66 | /**
67 | * {@inheritdoc}
68 | */
69 | public function __toString()
70 | {
71 | return $this->getTitle();
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/src/Slack/Channel.php:
--------------------------------------------------------------------------------
1 |
11 | *
12 | * @since 0.1.0
13 | */
14 | class Channel extends SerializeToString implements ChannelInterface
15 | {
16 | private $name;
17 |
18 | /**
19 | * Channel constructor.
20 | *
21 | * @param string $name
22 | */
23 | public function __construct($name)
24 | {
25 | $this->setName($name);
26 | }
27 |
28 | /**
29 | * @param string $name
30 | *
31 | * @return self
32 | */
33 | private function setName($name)
34 | {
35 | // names should be lowercase so we just enforce this without further validation
36 | $name = trim(mb_strtolower($name, 'UTF8'));
37 |
38 | if (!preg_match('_^[#@][\w-]{1,21}$_', $name)) {
39 | throw new InvalidChannelException(
40 | 'Channel names must be all lowercase.
41 | The name should start with "#" for a channel or "@" for an account
42 | They cannot be longer than 21 characters and can only contain letters, numbers, hyphens, and underscores.',
43 | 400
44 | );
45 | }
46 |
47 | $this->name = $name;
48 | }
49 |
50 | /**
51 | * {@inheritdoc}
52 | */
53 | public function getChannel()
54 | {
55 | return $this->name;
56 | }
57 |
58 | /**
59 | * {@inheritdoc}
60 | */
61 | public function __toString()
62 | {
63 | return $this->getChannel();
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/tests/Unit/Slack/Attachment/ColourTest.php:
--------------------------------------------------------------------------------
1 | assertEquals(Colour::COLOUR_GOOD, new Colour(Colour::COLOUR_GOOD));
13 | $this->assertEquals(Colour::COLOUR_WARNING, new Colour(Colour::COLOUR_WARNING));
14 | $this->assertEquals(Colour::COLOUR_DANGER, new Colour(Colour::COLOUR_DANGER));
15 | }
16 |
17 | public function testJsonEncoding()
18 | {
19 | $this->assertEquals('"' . Colour::COLOUR_GOOD . '"', json_encode(new Colour(Colour::COLOUR_GOOD)));
20 | }
21 |
22 | public function testGetter()
23 | {
24 | $this->assertEquals(Colour::COLOUR_DANGER, (new Colour(Colour::COLOUR_DANGER))->getColour());
25 | }
26 |
27 | public function testHexColours()
28 | {
29 | $hexColours = [
30 | '#FFFFFF',
31 | '#000000',
32 | '#C0C0C0',
33 | '#808080',
34 | '#FF0000',
35 | '#F0A804',
36 | '#FFFF00',
37 | '#008000',
38 | '#800080',
39 | '#09F',
40 | '#ADE',
41 | '#982',
42 | '#A67',
43 | ];
44 |
45 | array_walk(
46 | $hexColours,
47 | function ($hexColour) {
48 | $this->assertEquals($hexColour, new Colour($hexColour));
49 | }
50 | );
51 | }
52 |
53 | public function testInvalidColour()
54 | {
55 | $this->setExpectedException('\Pageon\SlackWebhookMonolog\Slack\Exceptions\InvalidColourException');
56 | new Colour('green');
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/src/Monolog/Config.php:
--------------------------------------------------------------------------------
1 |
11 | *
12 | * @since 0.1.0
13 | */
14 | class Config implements ConfigInterface
15 | {
16 | /**
17 | * @var int The lowest level that we should listen to.
18 | */
19 | private $level;
20 |
21 | /**
22 | * @var bool Do the events need to bubble further.
23 | */
24 | private $doesBubble;
25 |
26 | /**
27 | * Config constructor.
28 | *
29 | * @param int $level
30 | * @param bool $doesBubble
31 | */
32 | public function __construct($level, $doesBubble = true)
33 | {
34 | $this->setLevel($level);
35 | $this->doesBubble = $doesBubble;
36 | }
37 |
38 | /**
39 | * @param int $level
40 | *
41 | * @return self
42 | */
43 | private function setLevel($level)
44 | {
45 | $availableLevels = array_flip(Logger::getLevels());
46 |
47 | if (!isset($availableLevels[$level])) {
48 | throw new InvalidLoggerLevelException(
49 | sprintf(
50 | 'The level: "%d" does not exist. The available levels are: "%s"',
51 | $level,
52 | implode(', ', array_keys($availableLevels))
53 | ),
54 | 400
55 | );
56 | }
57 | $this->level = $level;
58 |
59 | return $this;
60 | }
61 |
62 | /**
63 | * {@inheritdoc}
64 | */
65 | public function getLevel()
66 | {
67 | return $this->level;
68 | }
69 |
70 | /**
71 | * {@inheritdoc}
72 | */
73 | public function doesBubble()
74 | {
75 | return $this->doesBubble;
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/src/General/Url.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * @since 0.4.0
11 | */
12 | class Url extends SerializeToString
13 | {
14 | /**
15 | * @var string
16 | */
17 | private $url;
18 |
19 | /**
20 | * @param string $url
21 | */
22 | public function __construct($url)
23 | {
24 | $this->setUrl($url);
25 | }
26 |
27 | /**
28 | * @param string $url
29 | *
30 | * @throws InvalidUrlException Thrown when the url is not valid
31 | *
32 | * @return $this
33 | */
34 | private function setUrl($url)
35 | {
36 | // remove the whitespace
37 | $url = trim($url);
38 |
39 | // @see https://gist.github.com/dperini/729294 and https://mathiasbynens.be/demo/url-regex
40 | $urlValidationRegex = '_^(?:(?:https?|ftp)://)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\x{00a1}-\x{ffff}0-9]+-?)*[a-z\x{00a1}-\x{ffff}0-9]+)(?:\.(?:[a-z\x{00a1}-\x{ffff}0-9]+-?)*[a-z\x{00a1}-\x{ffff}0-9]+)*(?:\.(?:[a-z\x{00a1}-\x{ffff}]{2,})))(?::\d{2,5})?(?:/[^\s]*)?$_iuS';
41 | if (!preg_match($urlValidationRegex, $url)) {
42 | throw new InvalidUrlException(sprintf('The url: "%s" is not a valid url.', $url), 400);
43 | }
44 | $this->url = $url;
45 |
46 | return $this;
47 | }
48 |
49 | /**
50 | * @return string
51 | */
52 | public function getUrl()
53 | {
54 | return $this->url;
55 | }
56 |
57 | /**
58 | * {@inheritdoc}
59 | */
60 | public function __toString()
61 | {
62 | return $this->getUrl();
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/tests/Unit/Monolog/ConfigTest.php:
--------------------------------------------------------------------------------
1 | assertInstanceOf(
17 | 'Pageon\SlackWebhookMonolog\Monolog\Interfaces\ConfigInterface',
18 | new Config(Logger::DEBUG),
19 | "The class doesn't implement the ConfigInterface"
20 | );
21 | }
22 |
23 | /**
24 | * Test if we have the correct level.
25 | */
26 | public function testLevel()
27 | {
28 | $config = new Config(Logger::DEBUG);
29 | $this->assertEquals(
30 | Logger::DEBUG,
31 | $config->getLevel(),
32 | sprintf('The level needs to be "%d"', Logger::DEBUG)
33 | );
34 | }
35 |
36 | /**
37 | * Test if we have the correct level.
38 | */
39 | public function testNonExistingLevel()
40 | {
41 | $this->setExpectedException(
42 | 'Pageon\SlackWebhookMonolog\Monolog\Exceptions\InvalidLoggerLevelException',
43 | '',
44 | 400
45 | );
46 | new Config('notExistingLevel');
47 | }
48 |
49 | /**
50 | * Test the bubble setting.
51 | */
52 | public function testBubble()
53 | {
54 | $this->assertTrue((new Config(Logger::DEBUG))->doesBubble(), 'The default bubble setting should be true');
55 | $this->assertTrue(
56 | (new Config(Logger::DEBUG, true))->doesBubble(),
57 | 'The default bubble setting should match the one in the constructor'
58 | );
59 | $this->assertFalse(
60 | (new Config(Logger::DEBUG, false))->doesBubble(),
61 | 'The default bubble setting should match the one in the constructor'
62 | );
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/src/Slack/EmojiIcon.php:
--------------------------------------------------------------------------------
1 |
11 | *
12 | * @since 0.1.0
13 | */
14 | class EmojiIcon extends SerializeToString implements IconInterface
15 | {
16 | /**
17 | * @var string
18 | */
19 | private $emoji;
20 |
21 | /**
22 | * UrlIcon constructor.
23 | *
24 | * @param string $emoji
25 | */
26 | public function __construct($emoji)
27 | {
28 | $this->setEmoji($emoji);
29 | }
30 |
31 | /**
32 | * This will set the emoji if it is valid.
33 | *
34 | * @param string $emoji
35 | *
36 | * @throws InvalidEmojiException Thrown when the emoji is not valid
37 | *
38 | * @return $this
39 | */
40 | private function setEmoji($emoji)
41 | {
42 | // remove the whitespace
43 | $emoji = trim($emoji);
44 |
45 | $emojiValidationRegex = '_^:[\w-+]+:$_iuS';
46 | if (!preg_match($emojiValidationRegex, $emoji)) {
47 | throw new InvalidEmojiException(
48 | sprintf(
49 | 'The emoji: "%s" is not a valid emoji.
50 | An emoji should always be a string starting and ending with ":".',
51 | $emoji
52 | ),
53 | 400
54 | );
55 | }
56 | $this->emoji = $emoji;
57 |
58 | return $this;
59 | }
60 |
61 | /**
62 | * {@inheritdoc}
63 | */
64 | public function getIcon()
65 | {
66 | return $this->emoji;
67 | }
68 |
69 | /**
70 | * {@inheritdoc}
71 | */
72 | public function __toString()
73 | {
74 | return $this->getIcon();
75 | }
76 |
77 | /**
78 | * {@inheritdoc}
79 | */
80 | public function getType()
81 | {
82 | return 'emoji';
83 | }
84 | }
85 |
--------------------------------------------------------------------------------
/src/Slack/Attachment/ParametersAttachment.php:
--------------------------------------------------------------------------------
1 |
12 | *
13 | * @since 0.4.1
14 | */
15 | class ParametersAttachment extends Attachment
16 | {
17 | /**
18 | * Extra error data.
19 | *
20 | * @var ErrorInterface
21 | */
22 | private $error;
23 |
24 | /**
25 | * @var StringFormat
26 | */
27 | private $formatter;
28 |
29 | /**
30 | * @param ErrorInterface $error
31 | * @param StringFormat $formatter
32 | */
33 | public function __construct(ErrorInterface $error, StringFormat $formatter)
34 | {
35 | parent::__construct('Parameters');
36 | $this->error = $error;
37 | $this->formatter = $formatter;
38 |
39 | $this->setTitle(new Title('Parameters'));
40 |
41 | foreach ((array) $this->error->getParameters() as $name => $parameter) {
42 | $this->addField(new Field($name, $this->parseParameter($parameter)));
43 | }
44 | }
45 |
46 | /**
47 | * Parse all the data into the markup of slack.
48 | *
49 | * @param mixed $parameter
50 | *
51 | * @return string
52 | */
53 | private function parseParameter($parameter)
54 | {
55 | if (!is_array($parameter)) {
56 | return print_r($parameter, true);
57 | }
58 |
59 | return $this->parseArrayParameter($parameter);
60 | }
61 |
62 | /**
63 | * @param array $parameter
64 | *
65 | * @return string
66 | */
67 | private function parseArrayParameter(array $parameter)
68 | {
69 | return "\n" . $this->formatter->arrayToKeyValueList(
70 | array_map(
71 | function ($item) {
72 | return print_r($item, true);
73 | },
74 | $parameter
75 | )
76 | );
77 | }
78 | }
79 |
--------------------------------------------------------------------------------
/src/Slack/Attachment/Author.php:
--------------------------------------------------------------------------------
1 |
12 | *
13 | * @since 0.4.0
14 | */
15 | final class Author extends SerializeToString
16 | {
17 | /**
18 | * Small text used to display the author's name.
19 | *
20 | * @var string
21 | */
22 | private $name;
23 |
24 | /**
25 | * A valid URL that will hyperlink the name.
26 | *
27 | * @var Url|null
28 | */
29 | private $link;
30 |
31 | /**
32 | * A valid URL that displays a small 16x16px image to the left of the name.
33 | *
34 | * @var Url|null
35 | */
36 | private $icon;
37 |
38 | /**
39 | * Author constructor.
40 | *
41 | * @param string $name
42 | * @param Url|null $link
43 | * @param Url|null $icon
44 | */
45 | public function __construct($name, Url $link = null, Url $icon = null)
46 | {
47 | $this->name = $name;
48 | $this->link = $link;
49 | $this->icon = $icon;
50 | }
51 |
52 | /**
53 | * @return string
54 | */
55 | public function getName()
56 | {
57 | return $this->name;
58 | }
59 |
60 | /**
61 | * @return Url|null
62 | */
63 | public function getLink()
64 | {
65 | return $this->link;
66 | }
67 |
68 | /**
69 | * @return bool
70 | */
71 | public function hasLink()
72 | {
73 | return $this->link !== null;
74 | }
75 |
76 | /**
77 | * @return Url|null
78 | */
79 | public function getIcon()
80 | {
81 | return $this->icon;
82 | }
83 |
84 | /**
85 | * @return bool
86 | */
87 | public function hasIcon()
88 | {
89 | return $this->icon !== null;
90 | }
91 |
92 | /**
93 | * {@inheritdoc}
94 | */
95 | public function __toString()
96 | {
97 | return $this->getName();
98 | }
99 | }
100 |
--------------------------------------------------------------------------------
/src/Slack/Attachment/Colour.php:
--------------------------------------------------------------------------------
1 |
13 | *
14 | * @since 0.4.0
15 | */
16 | final class Colour extends SerializeToString
17 | {
18 | const COLOUR_GOOD = 'good';
19 | const COLOUR_WARNING = 'warning';
20 | const COLOUR_DANGER = 'danger';
21 |
22 | /**
23 | * @var string
24 | */
25 | private $colour;
26 |
27 | /**
28 | * @param string $colour
29 | */
30 | public function __construct($colour)
31 | {
32 | $this->setColour($colour);
33 | }
34 |
35 | /**
36 | * Set the colour if it is a valid colour.
37 | *
38 | * @param $colour
39 | */
40 | private function setColour($colour)
41 | {
42 | if (!in_array($colour, $this->getDefaultColours()) &&
43 | !preg_match(
44 | '_^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$_',
45 | $colour
46 | )
47 | ) {
48 | throw new InvalidColourException(
49 | sprintf(
50 | 'The colour "%s" is not a valid colour. Possible options are "%s" or a valid hex colour',
51 | $colour,
52 | implode('", "', $this->getDefaultColours())
53 | )
54 | );
55 | }
56 |
57 | $this->colour = $colour;
58 | }
59 |
60 | /**
61 | * @return string
62 | */
63 | public function getColour()
64 | {
65 | return $this->colour;
66 | }
67 |
68 | /**
69 | * {@inheritdoc}
70 | */
71 | public function __toString()
72 | {
73 | return $this->getColour();
74 | }
75 | /**
76 | * Get the possible default colours.
77 | *
78 | * @return array
79 | */
80 | private function getDefaultColours()
81 | {
82 | return [
83 | self::COLOUR_GOOD,
84 | self::COLOUR_WARNING,
85 | self::COLOUR_DANGER,
86 | ];
87 | }
88 | }
89 |
--------------------------------------------------------------------------------
/tests/Unit/Slack/ConfigTest.php:
--------------------------------------------------------------------------------
1 | assertInstanceOf(
20 | 'Pageon\SlackWebhookMonolog\Slack\Interfaces\ConfigInterface',
21 | new Config(
22 | new Webhook(new Url('https://hooks.slack.com/services/XXXXXXXXX/XXXXXXXXX/XXXXXXXXXXXXXXXXXXXXXXXXX'))
23 | ),
24 | "The class doesn't implement the ConfigInterface"
25 | );
26 | }
27 |
28 | /**
29 | * This will test if we actually get a webhook back.
30 | */
31 | public function testWebhook()
32 | {
33 | $webhook = new Webhook(
34 | new Url('https://hooks.slack.com/services/XXXXXXXXX/XXXXXXXXX/XXXXXXXXXXXXXXXXXXXXXXXXX')
35 | );
36 | $config = new Config($webhook);
37 | $this->assertEquals($webhook, $config->getWebhook());
38 | }
39 |
40 | public function testCustomUser()
41 | {
42 | $webhook = new Webhook(
43 | new Url('https://hooks.slack.com/services/XXXXXXXXX/XXXXXXXXX/XXXXXXXXXXXXXXXXXXXXXXXXX')
44 | );
45 | $configWithoutCustomUser = new Config($webhook);
46 | $this->assertFalse(
47 | $configWithoutCustomUser->hasCustomUser(),
48 | 'When there is no custom user the function hasCustomUser should return false'
49 | );
50 |
51 | $user = new User(new Username('@pageon'));
52 | $configWithCustomUser = new Config(
53 | $webhook,
54 | $user
55 | );
56 | $this->assertTrue(
57 | $configWithCustomUser->hasCustomUser(),
58 | 'When there is a CustomUser the function hasCustomUser should return true'
59 | );
60 |
61 | $this->assertEquals(
62 | $user,
63 | $configWithCustomUser->getCustomUser(),
64 | 'The returned user should be the same as the provided user'
65 | );
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/tests/Unit/Slack/Attachment/BasicInfoAttachmentTest.php:
--------------------------------------------------------------------------------
1 | 'foo',
15 | 'level' => Logger::ALERT,
16 | 'level_name' => 'ALERT',
17 | 'datetime' => new \DateTime(),
18 | 'context' => ['foo' => 'bar'],
19 | ];
20 |
21 | $attachment = new BasicInfoAttachment($record);
22 | $data = $attachment->get();
23 |
24 | $this->assertArrayHasKey(2, $data['fields']);
25 | $context = $data['fields'][2]->jsonSerialize();
26 | $this->assertSame('Context', $context['title']);
27 | $this->assertSame(json_encode(['foo' => 'bar']), $context['value']);
28 | }
29 |
30 | public function testIncludesExtraIfRecordHasIt()
31 | {
32 | $record = [
33 | 'message' => 'foo',
34 | 'level' => Logger::ALERT,
35 | 'level_name' => 'ALERT',
36 | 'datetime' => new \DateTime(),
37 | 'extra' => ['foo' => 'bar'],
38 | ];
39 |
40 | $attachment = new BasicInfoAttachment($record);
41 | $data = $attachment->get();
42 |
43 | $this->assertArrayHasKey(2, $data['fields']);
44 | $context = $data['fields'][2]->jsonSerialize();
45 | $this->assertSame('Extra', $context['title']);
46 | $this->assertSame(json_encode(['foo' => 'bar']), $context['value']);
47 | }
48 |
49 | public function testIncludesDateStamp()
50 | {
51 | $date = new \DateTime();
52 | $record = [
53 | 'message' => 'foo',
54 | 'level' => Logger::ALERT,
55 | 'level_name' => 'ALERT',
56 | 'datetime' => $date,
57 | 'extra' => ['foo' => 'bar'],
58 | ];
59 |
60 | $attachment = new BasicInfoAttachment($record);
61 | $data = $attachment->get();
62 |
63 | $this->assertArrayHasKey(1, $data['fields']);
64 | $when = $data['fields'][1]->jsonSerialize();
65 |
66 | $this->assertSame('When', $when['title']);
67 | $this->assertSame($date->format('d/m/Y H:i:s'), $when['value']);
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/tests/Unit/Slack/UserTest.php:
--------------------------------------------------------------------------------
1 | assertInstanceOf(
18 | 'Pageon\SlackWebhookMonolog\Slack\Interfaces\UserInterface',
19 | new User(),
20 | "The class doesn't implement the UserInterface"
21 | );
22 | }
23 |
24 | /**
25 | * This will test if the check for the existence of a username works properly.
26 | */
27 | public function testUsername()
28 | {
29 | $userWithoutUsername = new User();
30 | $this->assertFalse(
31 | $userWithoutUsername->hasUsername(),
32 | 'When there is no Username the function hasUsername should return false'
33 | );
34 |
35 | $username = new Username('Han Solo');
36 | $userWithUsername = new User($username);
37 | $this->assertTrue(
38 | $userWithUsername->hasUsername(),
39 | 'When there is a Username the function hasUsername should return true'
40 | );
41 |
42 | $this->assertEquals(
43 | $username,
44 | $userWithUsername->getUsername(),
45 | 'The returned username should be the same as the provided username'
46 | );
47 | }
48 |
49 | /**
50 | * This will test if the check for the existence of a icon works properly.
51 | */
52 | public function testIcon()
53 | {
54 | $userWithoutIcon = new User();
55 | $this->assertFalse(
56 | $userWithoutIcon->hasIcon(),
57 | 'When there is no Icon the function hasIcon should return false'
58 | );
59 |
60 | $icon = new EmojiIcon(':angel:');
61 | $userWithIcon = new User(null, $icon);
62 | $this->assertTrue(
63 | $userWithIcon->hasIcon(),
64 | 'When there is a Icon the function hasIcon should return true'
65 | );
66 |
67 | $this->assertEquals(
68 | $icon,
69 | $userWithIcon->getIcon(),
70 | 'The returned icon should be the same as the provided icon'
71 | );
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/src/Monolog/SlackWebhookHandler.php:
--------------------------------------------------------------------------------
1 |
14 | *
15 | * @since 0.1.0
16 | */
17 | class SlackWebhookHandler extends AbstractProcessingHandler
18 | {
19 | /**
20 | * @var SlackConfig
21 | */
22 | private $slackConfig;
23 |
24 | /**
25 | * @var MonologConfig
26 | */
27 | private $monologConfig;
28 |
29 | /**
30 | * @var Curl\Util
31 | */
32 | private $curlUtil;
33 |
34 | /**
35 | * SlackWebhookHandler constructor.
36 | *
37 | * @param SlackConfig $slackConfig
38 | * @param MonologConfig $monologConfig
39 | *
40 | * @throws MissingExtensionException When the curl extension is not activated
41 | */
42 | public function __construct(SlackConfig $slackConfig, MonologConfig $monologConfig, Curl\Util $curlUtil)
43 | {
44 | parent::__construct($monologConfig->getLevel(), $monologConfig->doesBubble());
45 |
46 | $this->slackConfig = $slackConfig;
47 | $this->monologConfig = $monologConfig;
48 | $this->curlUtil = $curlUtil;
49 | }
50 |
51 | /**
52 | * {@inheritdoc}
53 | */
54 | public function write(array $record)
55 | {
56 | $curlUtil = $this->curlUtil;
57 |
58 | $curlSession = curl_init();
59 | curl_setopt($curlSession, CURLOPT_URL, $this->slackConfig->getWebhook());
60 | curl_setopt($curlSession, CURLOPT_POST, true);
61 | curl_setopt($curlSession, CURLOPT_RETURNTRANSFER, true);
62 | curl_setopt($curlSession, CURLOPT_POSTFIELDS, $this->getPayload($record));
63 |
64 | // we return this because our mock will return the curl session
65 | return $curlUtil::execute($curlSession);
66 | }
67 |
68 | /**
69 | * Prepares content data.
70 | *
71 | * @param array $record
72 | *
73 | * @return array
74 | */
75 | private function getPayload($record)
76 | {
77 | return [
78 | 'payload' => new Payload($record, $this->slackConfig),
79 | ];
80 | }
81 | }
82 |
--------------------------------------------------------------------------------
/tests/Unit/Slack/UrlIconTest.php:
--------------------------------------------------------------------------------
1 | assertInstanceOf(
16 | 'Pageon\SlackWebhookMonolog\Slack\Interfaces\IconInterface',
17 | new UrlIcon('http://placehold.it/512x512.png'),
18 | "The class doesn't implement the IconInterface"
19 | );
20 | }
21 |
22 | /**
23 | * Do we actually get the icon back we put into the class?
24 | */
25 | public function testGetIcon()
26 | {
27 | $url = 'http://placehold.it/512x512.png';
28 | $urlIcon = new UrlIcon($url);
29 | $this->assertEquals($url, $urlIcon->getIcon(), 'The icon url is not returned correctly');
30 | }
31 |
32 | /**
33 | * This will test the _toString implementation.
34 | */
35 | public function testToString()
36 | {
37 | $url = 'http://placehold.it/512x512.png';
38 | $urlIcon = new UrlIcon($url);
39 | $this->assertEquals($url, $urlIcon, 'When the Icon is cast to string it should return the url');
40 | }
41 |
42 | /**
43 | * Are only urls allowed for the icon?
44 | */
45 | public function testValidateUrl()
46 | {
47 | $this->setExpectedException('Pageon\SlackWebhookMonolog\General\Exceptions\InvalidUrlException');
48 | new UrlIcon('notAnUrl');
49 | }
50 |
51 | /**
52 | * This will test if the whitespace around the url is trimmed.
53 | */
54 | public function testWhiteSpaceAroundUrl()
55 | {
56 | $url = 'http://placehold.it/512x512.png';
57 | $this->assertEquals($url, new UrlIcon(' ' . $url), 'Whitespace before the url should be trimmed');
58 | $this->assertEquals($url, new UrlIcon($url . ' '), 'Whitespace after the url should be trimmed');
59 | $this->assertEquals(
60 | $url,
61 | new UrlIcon(' ' . $url . ' '),
62 | 'Whitespace before and after the url should be trimmed'
63 | );
64 | }
65 |
66 | /**
67 | * The return of the jsonSerialize function should match the toString implementation.
68 | */
69 | public function testJsonSerialize()
70 | {
71 | $icon = new UrlIcon('http://placehold.it/512x512.png');
72 |
73 | $this->assertEquals((string) $icon, $icon->jsonSerialize());
74 | }
75 | }
76 |
--------------------------------------------------------------------------------
/tests/Unit/Slack/UsernameTest.php:
--------------------------------------------------------------------------------
1 | assertInstanceOf(
16 | 'Pageon\SlackWebhookMonolog\Slack\Interfaces\UsernameInterface',
17 | new Username('Pageon'),
18 | "The class doesn't implement the UsernameInterface"
19 | );
20 | }
21 |
22 | /**
23 | * Do we actually get the username back we put into the class?
24 | */
25 | public function testGetUsername()
26 | {
27 | $usernameString = 'Pageon';
28 | $username = new Username($usernameString);
29 | $this->assertEquals($usernameString, $username->getUsername(), 'The username is not returned correctly');
30 | }
31 |
32 | /**
33 | * This will test the _toString implementation.
34 | */
35 | public function testToString()
36 | {
37 | $usernameString = 'Pageon';
38 | $username = new Username($usernameString);
39 | $this->assertEquals(
40 | $usernameString,
41 | $username,
42 | 'When the Username is cast to string it should return the username'
43 | );
44 | }
45 |
46 | /**
47 | * This will test if the whitespace around the username is trimmed.
48 | */
49 | public function testWhiteSpaceAroundUsername()
50 | {
51 | $usernameString = 'Pageon';
52 | $this->assertEquals(
53 | $usernameString,
54 | new Username($usernameString . ' '),
55 | 'Whitespace after the username should be trimmed'
56 | );
57 | $this->assertEquals(
58 | $usernameString,
59 | new Username($usernameString . ' '),
60 | 'Whitespace after the username should be trimmed'
61 | );
62 | $this->assertEquals(
63 | $usernameString,
64 | new Username(' ' . $usernameString . ' '),
65 | 'Whitespace before and after the username should be trimmed'
66 | );
67 | }
68 |
69 | /**
70 | * The return of the jsonSerialize function should match the toString implementation.
71 | */
72 | public function testJsonSerialize()
73 | {
74 | $username = new Username('carakas');
75 |
76 | $this->assertEquals((string) $username, $username->jsonSerialize());
77 | }
78 | }
79 |
--------------------------------------------------------------------------------
/src/Slack/Attachment/TraceAttachment.php:
--------------------------------------------------------------------------------
1 |
12 | *
13 | * @since 0.4.1
14 | */
15 | class TraceAttachment extends Attachment
16 | {
17 | /**
18 | * Extra error data.
19 | *
20 | * @var ErrorInterface
21 | */
22 | private $error;
23 |
24 | /**
25 | * @var StringFormat
26 | */
27 | private $formatter;
28 |
29 | /**
30 | * TraceAttachment constructor.
31 | *
32 | * @param ErrorInterface $error
33 | * @param StringFormat $formatter
34 | */
35 | public function __construct(ErrorInterface $error, StringFormat $formatter)
36 | {
37 | parent::__construct('Trace');
38 | $this->error = $error;
39 | $this->formatter = $formatter;
40 |
41 | $this->setTitle(new Title('Trace'));
42 | $this->setText(
43 | $formatter->arrayToNumberedList(
44 | array_map(
45 | function ($traceItem) {
46 | return $this->parseTraceItem($traceItem);
47 | },
48 | $this->error->getTrace()
49 | )
50 | )
51 | );
52 | }
53 |
54 | /**
55 | * Parse all the data into the markup of slack.
56 | *
57 | * @param array $traceItem
58 | *
59 | * @return string
60 | */
61 | private function parseTraceItem(array $traceItem)
62 | {
63 | $text = '';
64 | $info = [
65 | 'file' => $this->getArrayValue($traceItem, 'file', 'unknown'),
66 | 'function' => $this->getArrayValue($traceItem, 'function', 'unknown'),
67 | 'line' => $this->getArrayValue($traceItem, 'line', 'unknown'),
68 | 'class' => $this->getArrayValue($traceItem, 'class', 'unknown'),
69 | 'type' => $this->getArrayValue($traceItem, 'type', 'unknown'),
70 | ];
71 | $text .= $this->formatter->arrayToKeyValueList($info);
72 |
73 | return "\n" . $this->formatter->indent($text);
74 | }
75 |
76 | /**
77 | * @param array $array
78 | * @param string $key
79 | * @param mixed|null $fallback
80 | *
81 | * @return mixed
82 | */
83 | private function getArrayValue(array $array, $key, $fallback = null)
84 | {
85 | return isset($array[$key]) ? $array[$key] : $fallback;
86 | }
87 | }
88 |
--------------------------------------------------------------------------------
/tests/Unit/Monolog/SlackWebhookHandlerTest.php:
--------------------------------------------------------------------------------
1 | assertInstanceOf(
39 | 'Monolog\Handler\AbstractProcessingHandler',
40 | new SlackWebhookHandler(
41 | new SlackConfig(
42 | new Webhook(
43 | new Url('https://hooks.slack.com/services/XXXXXXXXX/XXXXXXXXX/XXXXXXXXXXXXXXXXXXXXXXXXX')
44 | )
45 | ),
46 | new MonologConfig(Logger::DEBUG),
47 | new CurlUtil()
48 | ),
49 | "The class doesn't implement the AbstractProcessingHandler interface of Monolog"
50 | );
51 | }
52 |
53 | public function testWrite()
54 | {
55 | $webhookUrl = new Url('https://hooks.slack.com/services/XXXXXXXXX/XXXXXXXXX/XXXXXXXXXXXXXXXXXXXXXXXXX');
56 | $handler = new SlackWebhookHandler(
57 | new SlackConfig(
58 | new Webhook($webhookUrl)
59 | ),
60 | new MonologConfig(Logger::DEBUG),
61 | new CurlUtil()
62 | );
63 |
64 | $curlSession = $handler->write($this->getRecord());
65 | $this->assertInternalType('resource', $curlSession);
66 |
67 | $curlSessionInfo = curl_getinfo($curlSession);
68 |
69 | $this->assertEquals($webhookUrl, $curlSessionInfo['url']);
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/tests/Unit/Slack/EmojiIconTest.php:
--------------------------------------------------------------------------------
1 | assertInstanceOf(
16 | 'Pageon\SlackWebhookMonolog\Slack\Interfaces\IconInterface',
17 | new EmojiIcon(':kissing_closed_eyes:'),
18 | "The class doesn't implement the IconInterface"
19 | );
20 | }
21 |
22 | /**
23 | * Do we actually get the icon back we put into the class?
24 | */
25 | public function testGetIcon()
26 | {
27 | $emoji = ':kissing_closed_eyes+1:';
28 | $emojiIcon = new EmojiIcon($emoji);
29 | $this->assertEquals($emoji, $emojiIcon->getIcon(), 'The icon emoji is not returned correctly');
30 | }
31 |
32 | /**
33 | * This will test the _toString implementation.
34 | */
35 | public function testToString()
36 | {
37 | $emoji = ':kissing_closed_eyes+1:';
38 | $emojiIcon = new EmojiIcon($emoji);
39 | $this->assertEquals($emoji, $emojiIcon, 'When the Icon is cast to string it should return the url');
40 | }
41 |
42 | /**
43 | * Are only valid emojis allowed for the icon?
44 | * An amoji of slack always needs to start and end with : and can not contain spaces.
45 | */
46 | public function testValidateEmoji()
47 | {
48 | $this->setExpectedException('Pageon\SlackWebhookMonolog\Slack\Exceptions\InvalidEmojiException');
49 | new EmojiIcon('notAn Empji');
50 | }
51 |
52 | /**
53 | * This will test if the whitespace around the emoji is trimmed.
54 | */
55 | public function testWhiteSpaceAroundUrl()
56 | {
57 | $emoji = ':kissing_closed_eyes+1:';
58 | $this->assertEquals($emoji, new EmojiIcon(' ' . $emoji), 'Whitespace before the emoji should be trimmed');
59 | $this->assertEquals($emoji, new EmojiIcon($emoji . ' '), 'Whitespace after the emoji should be trimmed');
60 | $this->assertEquals(
61 | $emoji,
62 | new EmojiIcon(' ' . $emoji . ' '),
63 | 'Whitespace before and after the emoji should be trimmed'
64 | );
65 | }
66 |
67 | /**
68 | * The return of the jsonSerialize function should match the toString implementation.
69 | */
70 | public function testJsonSerialize()
71 | {
72 | $icon = new EmojiIcon(':kissing_closed_eyes+1:');
73 |
74 | $this->assertEquals((string) $icon, $icon->jsonSerialize());
75 | }
76 | }
77 |
--------------------------------------------------------------------------------
/src/Slack/Webhook.php:
--------------------------------------------------------------------------------
1 |
12 | *
13 | * @since 0.1.0
14 | */
15 | class Webhook implements WebhookInterface
16 | {
17 | /**
18 | * The url of the webhook. This is provided by slack after creating a webhook.
19 | *
20 | * @var Url
21 | */
22 | private $url;
23 |
24 | /**
25 | * A custom channel to override the default set in slack.
26 | *
27 | * @var ChannelInterface|null
28 | */
29 | private $customChannel = null;
30 |
31 | /**
32 | * @param Url $url The webhook url provided by slack.
33 | * @param ChannelInterface|null $customChannel if no channel is provided the default will be used from the config in slack.
34 | */
35 | public function __construct(Url $url, ChannelInterface $customChannel = null)
36 | {
37 | $this->setUrl($url);
38 | $this->customChannel = $customChannel;
39 | }
40 |
41 | /**
42 | * {@inheritdoc}
43 | */
44 | public function getUrl()
45 | {
46 | return $this->url;
47 | }
48 |
49 | /**
50 | * This wil set the url if it is valid.
51 | *
52 | * @param Url $url
53 | *
54 | * @throws InvalidUrlException When it is not a valid webhook url of slack
55 | *
56 | * @return self
57 | */
58 | private function setUrl(Url $url)
59 | {
60 | $urlValidationRegex = '_https:\/\/hooks.slack.com\/services\/[\w\/]+$_iuS';
61 | if (!preg_match($urlValidationRegex, (string) $url)) {
62 | throw new InvalidUrlException(
63 | sprintf(
64 | 'The url: "%s" is not a valid url.
65 | Slack webhook urls should always start with "https://hooks.slack.com/services/"',
66 | $url
67 | ),
68 | 400
69 | );
70 | }
71 | $this->url = $url;
72 |
73 | return $this;
74 | }
75 |
76 | /**
77 | * {@inheritdoc}
78 | */
79 | public function __toString()
80 | {
81 | return (string) $this->getUrl();
82 | }
83 |
84 | /**
85 | * {@inheritdoc}
86 | */
87 | public function getCustomChannel()
88 | {
89 | return $this->customChannel;
90 | }
91 |
92 | /**
93 | * {@inheritdoc}
94 | */
95 | public function hasCustomChannel()
96 | {
97 | return $this->customChannel !== null;
98 | }
99 | }
100 |
--------------------------------------------------------------------------------
/src/Slack/Attachment/BasicInfoAttachment.php:
--------------------------------------------------------------------------------
1 |
12 | *
13 | * @since 0.4.0
14 | */
15 | class BasicInfoAttachment extends Attachment
16 | {
17 | /**
18 | * @var array The data from the error handler
19 | */
20 | private $record;
21 |
22 | /**
23 | * Extra error data.
24 | *
25 | * @var ErrorInterface
26 | */
27 | private $error;
28 |
29 | /**
30 | * BasicInfoAttachment constructor.
31 | *
32 | * @param array $record
33 | * @param ErrorInterface $error
34 | */
35 | public function __construct(array $record, ErrorInterface $error = null)
36 | {
37 | $this->record = $record;
38 | $this->error = $error;
39 |
40 | $message = ($this->error !== null) ? $this->error->getMessage() : $this->record['message'];
41 | parent::__construct($message);
42 |
43 | $this->setColour($this->getColourForLoggerLevel());
44 | $this->setText(sprintf('*Error:* %s', $this->record['level_name']));
45 | $this->addField(new Field('What', $message));
46 |
47 | $this->addField(new Field('When', $this->record['datetime']->format('d/m/Y H:i:s'), true));
48 |
49 | $this->addRecordDataAsJsonEncodedField('context', 'Context');
50 | $this->addRecordDataAsJsonEncodedField('extra', 'Extra');
51 |
52 | if ($this->error !== null) {
53 | $this->addField(new Field('Line', $this->error->getLine(), true));
54 | $this->addField(new Field('File', $this->error->getFile()));
55 | }
56 | }
57 |
58 | /**
59 | * Check if a key is available in the record. If so, add it as a field.
60 | *
61 | * @param string $key
62 | * @param string $label
63 | */
64 | private function addRecordDataAsJsonEncodedField($key, $label)
65 | {
66 | if (!empty($this->record[$key])) {
67 | $this->addField(new Field($label, json_encode($this->record[$key])));
68 | }
69 | }
70 |
71 | /**
72 | * Returned a Slack message attachment color associated with
73 | * provided level.
74 | *
75 | * @return Colour
76 | */
77 | private function getColourForLoggerLevel()
78 | {
79 | switch (true) {
80 | case $this->record['level'] >= Logger::ERROR:
81 | return new Colour('danger');
82 | case $this->record['level'] >= Logger::WARNING:
83 | return new Colour('warning');
84 | case $this->record['level'] >= Logger::INFO:
85 | return new Colour('good');
86 | default:
87 | return new Colour('#e3e4e6');
88 | }
89 | }
90 | }
91 |
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | 1.1.1 (2016-02-19)
2 | --
3 | Bugfixes:
4 |
5 | * Fix regression in code smell
6 |
7 | 1.1.O (2016-02-19)
8 | --
9 | Improvements:
10 |
11 | * Added link to implementation example
12 | * Include "context" and "extra" in basic info attachment (by michaelmoussa)
13 | * Removed the error from the context after extracting it
14 |
15 | Bugfixes:
16 |
17 | * Fix image in readme that should've been a link (by woutersioen)
18 |
19 | 1.0.3 (2016-02-13)
20 | --
21 | Improvements:
22 |
23 | * Provide minimal usage explanation in the readme
24 |
25 | 1.0.2 (2016-02-13)
26 | --
27 | Improvements:
28 |
29 | * Added an example picture of how the message arrived in Slack
30 |
31 | Bugfixes:
32 |
33 | 1.0.1 (2016-02-13)
34 | --
35 | Improvements:
36 |
37 | Bugfixes:
38 |
39 | * Stop logging the arguments of the backtrace since that can lead to memory overflow
40 |
41 | 1.0.0 (2016-02-13)
42 | --
43 | Improvements:
44 |
45 | * added attachment for the trace
46 | * added attachment for the parameters
47 | * code style improvements
48 |
49 | Bugfixes:
50 |
51 | * fix newlines in the formatter class
52 |
53 | 0.4.0 (2016-02-13)
54 | --
55 | Improvements:
56 |
57 | * Use attachments instead of the plain text messages.
58 | * Move SerializeToString to the General namespace.
59 | * Add a general Url so we don't need to keep duplicating the validation.
60 | * Added a class for slack string formatting.
61 |
62 | Bugfixes:
63 |
64 | 0.3.1 (2016-02-09)
65 | --
66 | Improvements:
67 |
68 | Bugfixes:
69 |
70 | * Make sure that the var parameters in the Error class is an array
71 |
72 | 0.3.0 (2016-02-09)
73 | --
74 | Improvements:
75 |
76 | * Refactor the code to set the channel name
77 | * Added an error class containing extra information about what happened
78 | * Implement all the customization options
79 | * Code style
80 |
81 | Bugfixes:
82 |
83 | * Fully remove all traces of the socket implementation
84 |
85 |
86 | 0.2.1 (2016-02-07)
87 | --
88 | Improvements:
89 |
90 | Bugfixes:
91 |
92 | * Updated the tests to reflect the changes from version 0.2.0
93 |
94 |
95 | 0.2.0 (2016-02-07)
96 | --
97 | Improvements:
98 |
99 | * Add interface to include extra error information.
100 |
101 | Bugfixes:
102 |
103 | * Moved away from sockets to curl because of connectivity errors (not all notifications arrived in slack).
104 |
105 |
106 | 0.1.2 (2016-02-03)
107 | --
108 | Improvements:
109 |
110 | * Lower the required version of monolog so we can use this class with Fork CMS
111 |
112 | Bugfixes:
113 |
114 |
115 | 0.1.1 (2016-01-31)
116 | --
117 | Improvements:
118 |
119 | * Added travis
120 | * Added badges to the README file
121 | * Removed some code duplications
122 |
123 | Bugfixes:
124 | * Fix wrong return type in Monolog ConfigInterface for the Level
125 |
126 | 0.1.0 (2016-01-31)
127 | --
128 | Improvements:
129 |
130 | * Initial implementation
131 |
132 | Bugfixes:
133 |
--------------------------------------------------------------------------------
/tests/Unit/Slack/StringFormatTest.php:
--------------------------------------------------------------------------------
1 | assertEquals('bob & co', $stringFormat->escape('bob & co'));
19 | $this->assertEquals('knowledge > power', $stringFormat->escape('knowledge > power'));
20 | $this->assertEquals('<--', $stringFormat->escape('<--'));
21 | }
22 |
23 | public function testEmphasis()
24 | {
25 | $stringFormat = new StringFormat();
26 |
27 | $this->assertEquals('*emphasised text*', $stringFormat->emphasis('emphasised text'));
28 | }
29 |
30 | public function testItalicize()
31 | {
32 | $stringFormat = new StringFormat();
33 |
34 | $this->assertEquals('_italicized text_', $stringFormat->italicize('italicized text'));
35 | }
36 |
37 | public function testStrikethrough()
38 | {
39 | $stringFormat = new StringFormat();
40 |
41 | $this->assertEquals('~strikethrough text~', $stringFormat->strikethrough('strikethrough text'));
42 | }
43 |
44 | public function testArrayToNumberedList()
45 | {
46 | $stringFormat = new StringFormat();
47 |
48 | $this->assertEquals(
49 | "1. First item\n2. Second item\n3. Third item\n",
50 | $stringFormat->arrayToNumberedList(['First item', 'Second item', 'Third item'])
51 | );
52 | }
53 |
54 | public function testArrayToBulletList()
55 | {
56 | $stringFormat = new StringFormat();
57 |
58 | $this->assertEquals(
59 | "• First item\n• Second item\n• Third item\n",
60 | $stringFormat->arrayToBulletList(['First item', 'Second item', 'Third item'])
61 | );
62 |
63 | $this->assertEquals(
64 | "§ First item\n§ Second item\n§ Third item\n",
65 | $stringFormat->arrayToBulletList(['First item', 'Second item', 'Third item'], '§')
66 | );
67 | }
68 |
69 | public function testPre()
70 | {
71 | $stringFormat = new StringFormat();
72 |
73 | $this->assertEquals('```lorem ipsum bla bla bla```', $stringFormat->pre('lorem ipsum bla bla bla'));
74 | }
75 |
76 | public function testCode()
77 | {
78 | $stringFormat = new StringFormat();
79 |
80 | $this->assertEquals('`$this->execute()`', $stringFormat->code('$this->execute()'));
81 | }
82 |
83 | public function testIndent()
84 | {
85 | $stringFormat = new StringFormat();
86 |
87 | $this->assertEquals('>I am indented', $stringFormat->indent('I am indented'));
88 | $this->assertEquals(
89 | ">I am indented\n>And the next line too",
90 | $stringFormat->indent("I am indented\nAnd the next line too")
91 | );
92 | }
93 | }
94 |
--------------------------------------------------------------------------------
/tests/Unit/General/UrlTest.php:
--------------------------------------------------------------------------------
1 | assertEquals($validUrl, (string) new Url($validUrl));
43 | }
44 | }
45 | public function testInValidLink()
46 | {
47 | $invalidUrls = [
48 | "http://",
49 | "http://.",
50 | "http://..",
51 | "http://../",
52 | "http://?",
53 | "http://??",
54 | "http://??/",
55 | "http://#",
56 | "http://##",
57 | "http://##/",
58 | "http://foo.bar?q=Spaces should be encoded",
59 | "//",
60 | "//a",
61 | "///a",
62 | "///",
63 | "http:///a",
64 | "foo.com",
65 | "rdar://1234",
66 | "h://test",
67 | "http:// shouldfail.com",
68 | ":// should fail",
69 | "http://foo.bar/foo(bar)baz quux",
70 | "ftps://foo.bar/",
71 | "http://-error-.invalid/",
72 | "http://a.b--c.de/",
73 | "http://-a.b.co",
74 | "http://a.b-.co",
75 | "http://0.0.0.0",
76 | "http://10.1.1.0",
77 | "http://10.1.1.255",
78 | "http://224.1.1.1",
79 | "http://1.1.1.1.1",
80 | "http://123.123.123",
81 | "http://3628126748",
82 | "http://.www.foo.bar/",
83 | "http://www.foo.bar./",
84 | "http://.www.foo.bar./",
85 | "http://10.1.1.1",
86 | "http://10.1.1.254"
87 | ];
88 |
89 | $exceptionCounter = 0;
90 | foreach ($invalidUrls as $invalidUrl) {
91 | try {
92 | new Url($invalidUrl);
93 | } catch (InvalidUrlException $e) {
94 | $exceptionCounter++;
95 | }
96 | }
97 |
98 | $this->assertEquals(count($invalidUrls), $exceptionCounter);
99 | }
100 | }
101 |
--------------------------------------------------------------------------------
/tests/Unit/Slack/WebhookTest.php:
--------------------------------------------------------------------------------
1 | assertInstanceOf(
18 | 'Pageon\SlackWebhookMonolog\Slack\Interfaces\WebhookInterface',
19 | new Webhook(new Url('https://hooks.slack.com/services/XXXXXXXXX/XXXXXXXXX/XXXXXXXXXXXXXXXXXXXXXXXXX')),
20 | "The class doesn't implement the WebhookInterface"
21 | );
22 | }
23 |
24 | /**
25 | * Do we actually get the icon back we put into the class?
26 | */
27 | public function testGetUrl()
28 | {
29 | $url = new Url('https://hooks.slack.com/services/XXXXXXXXX/XXXXXXXXX/XXXXXXXXXXXXXXXXXXXXXXXXX');
30 | $webhook = new Webhook($url);
31 | $this->assertEquals($url, $webhook->getUrl(), 'The webhook url is not returned correctly');
32 | }
33 |
34 | /**
35 | * This will test if the check for the existence of a username works properly.
36 | */
37 | public function testCustomChannel()
38 | {
39 | $webhookWithoutCustomChannel = new Webhook(
40 | new Url('https://hooks.slack.com/services/XXXXXXXXX/XXXXXXXXX/XXXXXXXXXXXXXXXXXXXXXXXXX')
41 | );
42 | $this->assertFalse(
43 | $webhookWithoutCustomChannel->hasCustomChannel(),
44 | 'When there is no custom channel the function hasCustomChannel should return false'
45 | );
46 |
47 | $channel = new Channel('@pageon');
48 | $webhookWithCustomChannel = new Webhook(
49 | new Url('https://hooks.slack.com/services/XXXXXXXXX/XXXXXXXXX/XXXXXXXXXXXXXXXXXXXXXXXXX'),
50 | $channel
51 | );
52 | $this->assertTrue(
53 | $webhookWithCustomChannel->hasCustomChannel(),
54 | 'When there is a CustomChannel the function hasCustomChannel should return true'
55 | );
56 |
57 | $this->assertEquals(
58 | $channel,
59 | $webhookWithCustomChannel->getCustomChannel(),
60 | 'The returned channel should be the same as the provided channel'
61 | );
62 | }
63 |
64 | /**
65 | * This will test the _toString implementation.
66 | */
67 | public function testToString()
68 | {
69 | $url = new Url('https://hooks.slack.com/services/XXXXXXXXX/XXXXXXXXX/XXXXXXXXXXXXXXXXXXXXXXXXX');
70 | $webhook = new Webhook($url);
71 | $this->assertEquals((string) $url, $webhook, 'When the Webhook is cast to string it should return the webhook url');
72 | }
73 |
74 | /**
75 | * Are only urls allowed for the webhook?
76 | */
77 | public function testValidateUrl()
78 | {
79 | $this->setExpectedException('Pageon\SlackWebhookMonolog\General\Exceptions\InvalidUrlException');
80 | new Webhook(new Url('http://google.com'));
81 | }
82 |
83 | /**
84 | * This will test if the whitespace around the webhook url is trimmed.
85 | */
86 | public function testWhiteSpaceAroundUrl()
87 | {
88 | $url = 'https://hooks.slack.com/services/XXXXXXXXX/XXXXXXXXX/XXXXXXXXXXXXXXXXXXXXXXXXX';
89 | $this->assertEquals($url, new Webhook(new Url(' ' . $url)), 'Whitespace before the url should be trimmed');
90 | $this->assertEquals($url, new Webhook(new Url($url . ' ')), 'Whitespace after the url should be trimmed');
91 | $this->assertEquals(
92 | $url,
93 | new Webhook(new Url(' ' . $url . ' ')),
94 | 'Whitespace before and after the url should be trimmed'
95 | );
96 | }
97 | }
98 |
--------------------------------------------------------------------------------
/tests/Unit/Monolog/ErrorTest.php:
--------------------------------------------------------------------------------
1 | assertInstanceOf(
16 | 'Pageon\SlackWebhookMonolog\Monolog\Interfaces\ErrorInterface',
17 | new Error('test message', 1, __FILE__),
18 | "The class doesn't implement the ErrorInterface"
19 | );
20 | }
21 |
22 | public function testMessage()
23 | {
24 | $error = new Error('test message', 1, __FILE__);
25 | $this->assertEquals('test message', $error->getMessage());
26 | }
27 |
28 | public function testLineNumber()
29 | {
30 | $error = new Error('test message', 1, __FILE__);
31 | $this->assertEquals(1, $error->getLine());
32 | }
33 |
34 | public function testFile()
35 | {
36 | $error = new Error('test message', 1, __FILE__);
37 | $this->assertEquals(__FILE__, $error->getFile());
38 | }
39 |
40 | public function testTrace()
41 | {
42 | $testTrace = debug_backtrace();
43 | $error = new Error('test message', 1, __FILE__, $testTrace);
44 |
45 | $this->assertEquals($testTrace, $error->getTrace());
46 | }
47 |
48 | public function testTraceFallback()
49 | {
50 | $fallbackTrace = [
51 | [
52 | 'line' => 1,
53 | 'file' => __FILE__,
54 | 'function' => 'unknown',
55 | ],
56 | ];
57 | $error = new Error('test message', $fallbackTrace[0]['line'], $fallbackTrace[0]['file']);
58 |
59 | $this->assertEquals($fallbackTrace, $error->getTrace());
60 | }
61 |
62 | public function testParameters()
63 | {
64 | $parameters = [
65 | '_POST' => [
66 | 'test',
67 | ],
68 | '_GET' => [
69 | 'test',
70 | ],
71 | '_COOKIE' => [
72 | 'test',
73 | ],
74 | '_SESSION' => [
75 | 'test',
76 | ],
77 | ];
78 |
79 | $error = new Error('test message', 1, __FILE__, null, $parameters);
80 |
81 | $this->assertEquals($parameters, $error->getParameters());
82 | }
83 |
84 | public function testParametersCookie()
85 | {
86 | $this->resetCookiePostGetAndSession();
87 |
88 | $_COOKIE['test_cookie'] = true;
89 | $error = new Error('test message', 1, __FILE__);
90 | $this->assertEquals(['_COOKIE' => ['test_cookie' => true]], $error->getParameters());
91 | }
92 |
93 | public function testParametersPost()
94 | {
95 | $this->resetCookiePostGetAndSession();
96 |
97 | $_POST['test_post'] = true;
98 | $error = new Error('test message', 1, __FILE__);
99 | $this->assertEquals(['_POST' => ['test_post' => true]], $error->getParameters());
100 | }
101 |
102 | public function testParametersGet()
103 | {
104 | $this->resetCookiePostGetAndSession();
105 |
106 | $_GET['test_GET'] = true;
107 | $error = new Error('test message', 1, __FILE__);
108 | $this->assertEquals(['_GET' => ['test_GET' => true]], $error->getParameters());
109 | }
110 |
111 | public function testParametersSession()
112 | {
113 | $this->resetCookiePostGetAndSession();
114 |
115 | $_SESSION['test_session'] = true;
116 | $error = new Error('test message', 1, __FILE__);
117 | $this->assertEquals(['_SESSION' => ['test_session' => true]], $error->getParameters());
118 | }
119 |
120 | private function resetCookiePostGetAndSession()
121 | {
122 | $_POST = $_GET = $_SESSION = $_COOKIE = null;
123 | }
124 | }
125 |
--------------------------------------------------------------------------------
/src/Monolog/Error.php:
--------------------------------------------------------------------------------
1 |
11 | */
12 | class Error implements ErrorInterface
13 | {
14 | /**
15 | * @var string
16 | */
17 | private $message;
18 |
19 | /**
20 | * @var int
21 | */
22 | private $line;
23 |
24 | /**
25 | * @var string
26 | */
27 | private $file;
28 |
29 | /**
30 | * @var array
31 | */
32 | private $trace;
33 |
34 | /**
35 | * @var array
36 | */
37 | private $parameters = [];
38 |
39 | /**
40 | * Create a new error wrapping the given error context info.
41 | *
42 | * @param string $message
43 | * @param int $line
44 | * @param string $file
45 | * @param array|null $trace
46 | * @param array|null $parameters
47 | */
48 | public function __construct($message, $line, $file, array $trace = null, array $parameters = null)
49 | {
50 | $this->setMessage($message);
51 | $this->setLine($line);
52 | $this->setFile($file);
53 | $this->setTrace($trace);
54 | $this->setParameters($parameters);
55 | }
56 |
57 | /**
58 | * @param string $file
59 | */
60 | private function setFile($file)
61 | {
62 | $this->file = $file;
63 | }
64 |
65 | /**
66 | * @return string
67 | */
68 | public function getFile()
69 | {
70 | return $this->file;
71 | }
72 |
73 | /**
74 | * @param int $line
75 | */
76 | private function setLine($line)
77 | {
78 | $this->line = $line;
79 | }
80 |
81 | /**
82 | * @return int
83 | */
84 | public function getLine()
85 | {
86 | return $this->line;
87 | }
88 |
89 | /**
90 | * @param string $message
91 | */
92 | private function setMessage($message)
93 | {
94 | $this->message = $message;
95 | }
96 |
97 | /**
98 | * @return string
99 | */
100 | public function getMessage()
101 | {
102 | return $this->message;
103 | }
104 |
105 | /**
106 | * @param array|null $parameters
107 | */
108 | private function setParameters(array $parameters = null)
109 | {
110 | $this->parameters = (array) $parameters;
111 |
112 | // make sure we have at least the POST, GET, COOKIE and SESSION data
113 | $this->addParameterFallback('_POST', $_POST);
114 | $this->addParameterFallback('_GET', $_GET);
115 | $this->addParameterFallback('_COOKIE', $_COOKIE);
116 | if (isset($_SESSION)) {
117 | $this->addParameterFallback('_SESSION', $_SESSION);
118 | }
119 | }
120 |
121 | /**
122 | * This will add fallback data to the parameters if the key is not set.
123 | *
124 | * @param string $name
125 | * @param mixed $fallbackData
126 | */
127 | private function addParameterFallback($name, $fallbackData = null)
128 | {
129 | if (!isset($this->parameters[$name]) && !empty($fallbackData)) {
130 | $this->parameters[$name] = $fallbackData;
131 | }
132 | }
133 |
134 | /**
135 | * @return array
136 | */
137 | public function getParameters()
138 | {
139 | return $this->parameters;
140 | }
141 |
142 | /**
143 | * @param array|null $trace
144 | */
145 | private function setTrace(array $trace = null)
146 | {
147 | if ($trace === null) {
148 | $trace = [
149 | [
150 | 'line' => $this->getLine(),
151 | 'file' => $this->getFile(),
152 | 'function' => 'unknown',
153 | ],
154 | ];
155 | }
156 | $this->trace = $trace;
157 | }
158 |
159 | /**
160 | * @return array
161 | */
162 | public function getTrace()
163 | {
164 | return $this->trace;
165 | }
166 | }
167 |
--------------------------------------------------------------------------------
/src/Slack/StringFormat.php:
--------------------------------------------------------------------------------
1 |
7 | *
8 | * @since 0.4.0
9 | */
10 | final class StringFormat
11 | {
12 | /**
13 | * There are three characters you must convert to HTML entities and only three: &, <, and >.
14 | * Don't HTML entity-encode the entire message, Slack will take care of the rest.
15 | * This function will do that for you.
16 | *
17 | * @param string $unescapedText
18 | *
19 | * @return string
20 | */
21 | public function escape($unescapedText)
22 | {
23 | return str_replace(['&', '<', '>'], ['&', '<', '>'], $unescapedText);
24 | }
25 |
26 | /**
27 | * This will emphasis the string by wrapping it between *.
28 | *
29 | * @param string $text
30 | *
31 | * @return string
32 | */
33 | public function emphasis($text)
34 | {
35 | return $this->wrapStringWith($text, '*');
36 | }
37 |
38 | /**
39 | * This will italicize the string by wrapping it between _.
40 | *
41 | * @param string $text
42 | *
43 | * @return string
44 | */
45 | public function italicize($text)
46 | {
47 | return $this->wrapStringWith($text, '_');
48 | }
49 |
50 | /**
51 | * This will strikethrough the string by wrapping it between ~.
52 | *
53 | * @param string $text
54 | *
55 | * @return string
56 | */
57 | public function strikethrough($text)
58 | {
59 | return $this->wrapStringWith($text, '~');
60 | }
61 |
62 | /**
63 | * Create a block of pre-formatted, fixed-width text.
64 | *
65 | * @param string $text
66 | *
67 | * @return string
68 | */
69 | public function pre($text)
70 | {
71 | return $this->wrapStringWith($text, '```');
72 | }
73 |
74 | /**
75 | * Display as inline fixed-width text.
76 | *
77 | * @param string $text
78 | *
79 | * @return string
80 | */
81 | public function code($text)
82 | {
83 | return $this->wrapStringWith($text, '`');
84 | }
85 |
86 | /**
87 | * Indent the text.
88 | * Because multi line indenting can't be closed in slack we implemented it for you.
89 | * When you use a new line it will be indented as well.
90 | *
91 | * @param string $text
92 | *
93 | * @return string
94 | */
95 | public function indent($text)
96 | {
97 | return '>' . str_replace("\n", "\n>", $text);
98 | }
99 |
100 | /**
101 | * This will generate a numbered list from an array.
102 | *
103 | * @param array $listItems
104 | *
105 | * @return string
106 | */
107 | public function arrayToNumberedList(array $listItems)
108 | {
109 | $formattedList = '';
110 | $number = 1;
111 |
112 | foreach ($listItems as $listItem) {
113 | $formattedList .= sprintf("%d. %s\n", $number++, (string) $listItem);
114 | }
115 |
116 | return $formattedList;
117 | }
118 |
119 | /**
120 | * This will generate a numbered list from an array.
121 | *
122 | * @param array $listItems
123 | *
124 | * @return string
125 | */
126 | public function arrayToKeyValueList(array $listItems)
127 | {
128 | $formattedList = '';
129 |
130 | foreach ($listItems as $key => $value) {
131 | $formattedList .= sprintf("%s: %s\n", $this->emphasis($key), (string) $value);
132 | }
133 |
134 | return $formattedList;
135 | }
136 |
137 | /**
138 | * This will generate a bullet list from an array.
139 | *
140 | * @param array $listItems
141 | * @param string $bulletCharacter The character used as bullet
142 | *
143 | * @return string
144 | */
145 | public function arrayToBulletList(array $listItems, $bulletCharacter = '•')
146 | {
147 | $formattedList = '';
148 |
149 | foreach ($listItems as $listItem) {
150 | $formattedList .= sprintf("%s %s\n", $bulletCharacter, (string) $listItem);
151 | }
152 |
153 | return $formattedList;
154 | }
155 |
156 | /**
157 | * Wraps a string with a wrapper string.
158 | *
159 | * @param string $text
160 | * @param string $wrapper
161 | *
162 | * @return string
163 | */
164 | private function wrapStringWith($text, $wrapper)
165 | {
166 | return sprintf('%1$s%2$s%1$s', $wrapper, $text);
167 | }
168 | }
169 |
--------------------------------------------------------------------------------
/src/Slack/Payload.php:
--------------------------------------------------------------------------------
1 |
18 | */
19 | class Payload implements JsonSerializable
20 | {
21 | /**
22 | * @var array The data from the error handler
23 | */
24 | private $record;
25 |
26 | /**
27 | * The data that will be send to the api.
28 | *
29 | * @var array
30 | */
31 | private $payload;
32 |
33 | /**
34 | * Extra error data.
35 | *
36 | * @var ErrorInterface
37 | */
38 | private $errorData;
39 |
40 | /**
41 | * Contains some extra information like channel and user etc that can be used in the payload.
42 | *
43 | * @var SlackConfigInterface
44 | */
45 | private $slackConfig;
46 |
47 | /**
48 | * Payload constructor.
49 | *
50 | * @param array $record
51 | * @param SlackConfigInterface $slackConfig
52 | */
53 | public function __construct(array $record, SlackConfigInterface $slackConfig = null)
54 | {
55 | $this->record = $record;
56 | $this->slackConfig = $slackConfig;
57 |
58 | $this->generatePayload();
59 | }
60 |
61 | private function generatePayload()
62 | {
63 | $this->setErrorData();
64 |
65 | $this->setAttachments();
66 |
67 | if ($this->slackConfig !== null) {
68 | $this->generatePayloadForSlackConfig();
69 | }
70 | }
71 |
72 | /**
73 | * Generate the payload for the slack config.
74 | */
75 | private function generatePayloadForSlackConfig()
76 | {
77 | $this->setChannel();
78 |
79 | if ($this->slackConfig->hasCustomUser()) {
80 | $this->generatePayloadForCustomUser();
81 | }
82 | }
83 |
84 | private function generatePayloadForCustomUser()
85 | {
86 | $this->setIcon();
87 | $this->setUsername();
88 | }
89 |
90 | /**
91 | * Set a custom icon if available.
92 | */
93 | private function setIcon()
94 | {
95 | if (!$this->slackConfig->getCustomUser()->hasIcon()) {
96 | return;
97 | }
98 |
99 | $iconType = 'icon_' . $this->slackConfig->getCustomUser()->getIcon()->getType();
100 | $this->payload[$iconType] = $this->slackConfig->getCustomUser()->getIcon();
101 | }
102 |
103 | /**
104 | * Set a custom username if available.
105 | */
106 | private function setUsername()
107 | {
108 | if (!$this->slackConfig->getCustomUser()->hasUsername()) {
109 | return;
110 | }
111 |
112 | $this->payload['username'] = $this->slackConfig->getCustomUser()->getUsername();
113 | }
114 |
115 | /**
116 | * Set a custom channel if available.
117 | */
118 | private function setChannel()
119 | {
120 | if (!$this->slackConfig->getWebhook()->hasCustomChannel()) {
121 | return;
122 | }
123 |
124 | $this->payload['channel'] = $this->slackConfig->getWebhook()->getCustomChannel();
125 | }
126 |
127 | /**
128 | * If available set the error data.
129 | */
130 | private function setErrorData()
131 | {
132 | if (!isset($this->record['context']['error'])) {
133 | return;
134 | }
135 |
136 | $this->errorData = $this->record['context']['error'];
137 |
138 | // remove the error from the context so we can use it for for other things.
139 | unset($this->record['context']['error']);
140 | }
141 |
142 | private function setAttachments()
143 | {
144 | $this->payload['attachments'] = [
145 | new BasicInfoAttachment($this->record, $this->errorData),
146 | ];
147 |
148 | if ($this->errorData !== null) {
149 | $this->addErrorSpecificAttachments();
150 | }
151 | }
152 |
153 | private function addErrorSpecificAttachments()
154 | {
155 | $formatter = new StringFormat();
156 | $this->payload['attachments'][] = new TraceAttachment($this->errorData, $formatter);
157 | $this->payload['attachments'][] = new ParametersAttachment($this->errorData, $formatter);
158 | }
159 |
160 | /**
161 | * {@inheritdoc}
162 | */
163 | public function jsonSerialize()
164 | {
165 | return $this->payload;
166 | }
167 |
168 | /**
169 | * {@inheritdoc}
170 | */
171 | public function __toString()
172 | {
173 | return json_encode($this->jsonSerialize());
174 | }
175 | }
176 |
--------------------------------------------------------------------------------
/tests/Unit/Slack/PayloadTest.php:
--------------------------------------------------------------------------------
1 | getRecord());
83 |
84 | $this->assertContains('"fallback":"Test success"', json_encode($payload));
85 | }
86 |
87 | public function testPayloadWithErrorContext()
88 | {
89 | $payload = new Payload($this->getRecord(true));
90 |
91 | $this->assertContains('"fallback":"Test with context"', (string) $payload);
92 | }
93 |
94 | public function testCustomChannel()
95 | {
96 | $webhookWithoutChannel = new Webhook(
97 | new Url('https://hooks.slack.com/services/XXXXXXXXX/XXXXXXXXX/XXXXXXXXXXXXXXXXXXXXXXXXX')
98 | );
99 | $payload = json_encode(new Payload($this->getRecord(true), new Config($webhookWithoutChannel)));
100 | $this->assertNotContains('"channel"', $payload);
101 |
102 | $payload = json_encode(new Payload($this->getRecord(true), new Config($this->getWebhook())));
103 | $this->assertContains('"channel":"#general"', $payload);
104 | }
105 |
106 | public function testCustomUsername()
107 | {
108 | $payload = json_encode(
109 | new Payload($this->getRecord(true), new Config($this->getWebhook(), $this->getUserWithUsername()))
110 | );
111 |
112 | $this->assertContains('"username":"ErrorBot"', $payload);
113 | }
114 |
115 | public function testCustomEmojiIcon()
116 | {
117 | $payload = json_encode(
118 | new Payload($this->getRecord(true), new Config($this->getWebhook(), $this->getEmojiIconUser()))
119 | );
120 |
121 | $this->assertContains('"icon_emoji":":alien:"', $payload);
122 | }
123 |
124 | public function testCustomUrlIcon()
125 | {
126 | $payload = json_encode(
127 | new Payload($this->getRecord(true), new Config($this->getWebhook(), $this->getUrlIconUser()))
128 | );
129 |
130 | $this->assertContains('"icon_url":"https:\/\/slack.com\/img\/icons\/app-57.png"', $payload);
131 | }
132 |
133 | public function testAttachmentColours()
134 | {
135 | $this->assertContains('"color":"danger"', json_encode(new Payload($this->getRecord(true))));
136 | $this->assertContains('"color":"warning"', json_encode(new Payload($this->getRecord(true, Logger::WARNING))));
137 | $this->assertContains('"color":"good"', json_encode(new Payload($this->getRecord(true, Logger::INFO))));
138 | $this->assertContains('"color":"#e3e4e6"', json_encode(new Payload($this->getRecord(true, Logger::DEBUG))));
139 | }
140 | }
141 |
--------------------------------------------------------------------------------
/src/Slack/Attachment/Attachment.php:
--------------------------------------------------------------------------------
1 |
12 | *
13 | * @since 0.4.0
14 | */
15 | class Attachment implements JsonSerializable
16 | {
17 | /**
18 | * The attachment itself.
19 | * We enable markdown in everything, why wouldn't we?
20 | *
21 | * @var array
22 | */
23 | private $attachment = ['mrkdwn_in' => ['pretext', 'text', 'fields']];
24 |
25 | /**
26 | * Attachment constructor.
27 | * I opted for setters since there are so many optional parameters.
28 | * A new instance would look be messy if you only needed the last optional parameter.
29 | *
30 | * @param string $fallback A plain-text summary of the attachment.
31 | */
32 | public function __construct($fallback)
33 | {
34 | if (empty($fallback)) {
35 | throw new \InvalidArgumentException('The fallback is required');
36 | }
37 |
38 | $this->attachment['fallback'] = $fallback;
39 | }
40 |
41 | /**
42 | * This is the main text in a message attachment.
43 | *
44 | * @param string $text
45 | *
46 | * @return self
47 | */
48 | public function setText($text)
49 | {
50 | $this->attachment['text'] = $text;
51 |
52 | return $this;
53 | }
54 |
55 | /**
56 | * This value is used to color the border along the left side of the message attachment.
57 | *
58 | * @param Colour $colour
59 | *
60 | * @return self
61 | */
62 | public function setColour(Colour $colour)
63 | {
64 | $this->attachment['color'] = $colour;
65 |
66 | return $this;
67 | }
68 |
69 | /**
70 | * This is optional text that appears above the message attachment block.
71 | *
72 | * @param string $pretext
73 | *
74 | * @return self
75 | */
76 | public function setPretext($pretext)
77 | {
78 | $this->attachment['pretext'] = $pretext;
79 |
80 | return $this;
81 | }
82 |
83 | /**
84 | * The author parameters will display a small section at the top of a message attachment.
85 | *
86 | * @param Author $author
87 | *
88 | * @return self
89 | */
90 | public function setAuthor(Author $author)
91 | {
92 | $this->attachment['author_name'] = $author;
93 |
94 | if ($author->hasIcon()) {
95 | $this->attachment['author_icon'] = $author->getIcon();
96 | }
97 |
98 | if ($author->hasLink()) {
99 | $this->attachment['author_link'] = $author->getLink();
100 | }
101 |
102 | return $this;
103 | }
104 |
105 | /**
106 | * The title is displayed as larger, bold text near the top of a message attachment.
107 | *
108 | * @param Title $title
109 | *
110 | * @return self
111 | */
112 | public function setTitle(Title $title)
113 | {
114 | $this->attachment['title'] = $title;
115 |
116 | if ($title->hasLink()) {
117 | $this->attachment['title_link'] = $title->getLink();
118 | }
119 |
120 | return $this;
121 | }
122 |
123 | /**
124 | * Will be displayed in a table inside the message attachment.
125 | *
126 | * @param Field $field
127 | *
128 | * @return self
129 | */
130 | public function addField(Field $field)
131 | {
132 | if (!isset($this->attachment['fields'])) {
133 | $this->attachment['fields'] = [];
134 | }
135 |
136 | $this->attachment['fields'][] = $field;
137 |
138 | return $this;
139 | }
140 |
141 | /**
142 | * Add multiple fields in 1 call.
143 | *
144 | * @param Field[] $fields
145 | *
146 | * @return self
147 | */
148 | public function addFields(array $fields)
149 | {
150 | foreach ($fields as $field) {
151 | $this->addField($field);
152 | }
153 |
154 | return $this;
155 | }
156 |
157 | /**
158 | * A valid URL to an image file that will be displayed inside a message attachment.
159 | *
160 | * @param Url $image
161 | *
162 | * @return self
163 | */
164 | public function setImage(Url $image)
165 | {
166 | $this->attachment['image_url'] = $image;
167 |
168 | return $this;
169 | }
170 |
171 | /**
172 | * A valid URL to an image file that will be displayed as a thumbnail on the right side of a message attachment.
173 | *
174 | * @param Url $thumbnail
175 | *
176 | * @return self
177 | */
178 | public function setThumbnail(Url $thumbnail)
179 | {
180 | $this->attachment['thumb_url'] = $thumbnail;
181 |
182 | return $this;
183 | }
184 |
185 | /**
186 | * {@inheritdoc}
187 | */
188 | public function jsonSerialize()
189 | {
190 | return $this->get();
191 | }
192 |
193 | /**
194 | * Get the attachment in the format that slack requires.
195 | *
196 | * @return array
197 | */
198 | public function get()
199 | {
200 | return $this->attachment;
201 | }
202 | }
203 |
--------------------------------------------------------------------------------
/tests/Unit/Slack/Attachment/AttachmentTest.php:
--------------------------------------------------------------------------------
1 | assertTrue(isset($attachment->get()['fallback']));
29 | $this->assertEquals($fallback, $attachment->get()['fallback']);
30 |
31 | $this->assertContains('"fallback":"' . $fallback . '"', json_encode($attachment));
32 |
33 | $this->setExpectedException('InvalidArgumentException', 'The fallback is required');
34 | new Attachment('');
35 | }
36 |
37 | public function testText()
38 | {
39 | $attachment = $this->getAttachment();
40 |
41 | $this->assertFalse(isset($attachment->get()['text']));
42 |
43 | $text = 'This is a dummy text';
44 | $attachment->setText($text);
45 |
46 | $this->assertTrue(isset($attachment->get()['text']));
47 | $this->assertEquals($text, $attachment->get()['text']);
48 |
49 | $this->assertContains('"text":"' . $text . '"', json_encode($attachment));
50 | }
51 |
52 | public function testPretext()
53 | {
54 | $attachment = $this->getAttachment();
55 |
56 | $this->assertFalse(isset($attachment->get()['pretext']));
57 |
58 | $pretext = 'This is a dummy pretext';
59 | $attachment->setPretext($pretext);
60 |
61 | $this->assertTrue(isset($attachment->get()['pretext']));
62 | $this->assertEquals($pretext, $attachment->get()['pretext']);
63 |
64 | $this->assertContains('"pretext":"' . $pretext . '"', json_encode($attachment));
65 | }
66 |
67 | public function testColour()
68 | {
69 | $attachment = $this->getAttachment();
70 |
71 | $this->assertFalse(isset($attachment->get()['color']));
72 |
73 | $colour = new Colour(Colour::COLOUR_GOOD);
74 | $attachment->setColour($colour);
75 |
76 | $this->assertTrue(isset($attachment->get()['color']));
77 | $this->assertEquals($colour, $attachment->get()['color']);
78 |
79 | $this->assertContains('"color":"' . $colour . '"', json_encode($attachment));
80 | }
81 |
82 | public function testImage()
83 | {
84 | $attachment = $this->getAttachment();
85 |
86 | $this->assertFalse(isset($attachment->get()['image_url']));
87 |
88 | $image = new Url('http://pageon.be/logo.png');
89 | $attachment->setImage($image);
90 |
91 | $this->assertTrue(isset($attachment->get()['image_url']));
92 | $this->assertEquals($image, $attachment->get()['image_url']);
93 |
94 | $this->assertContains('"image_url":' . json_encode($image), json_encode($attachment));
95 | }
96 |
97 | public function testThumbnail()
98 | {
99 | $attachment = $this->getAttachment();
100 |
101 | $this->assertFalse(isset($attachment->get()['thumb_url']));
102 |
103 | $thumbnail = new Url('http://pageon.be/logo.png');
104 | $attachment->setThumbnail($thumbnail);
105 |
106 | $this->assertTrue(isset($attachment->get()['thumb_url']));
107 | $this->assertEquals($thumbnail, $attachment->get()['thumb_url']);
108 |
109 | $this->assertContains('"thumb_url":' . json_encode($thumbnail), json_encode($attachment));
110 | }
111 |
112 | public function testAuthor()
113 | {
114 | $attachment = $this->getAttachment();
115 |
116 | $this->assertFalse(isset($attachment->get()['author_url']));
117 |
118 | $baseAuthor = new Author('jelmer');
119 | $attachment->setAuthor($baseAuthor);
120 | $this->assertTrue(isset($attachment->get()['author_name']));
121 | $this->assertEquals($baseAuthor, $attachment->get()['author_name']);
122 |
123 | $this->assertContains('"author_name":' . json_encode($baseAuthor), json_encode($attachment));
124 |
125 | $icon = new Url('http://pageon.be/logo.png');
126 | $link = new Url('http://pageon.be');
127 | $fullAuthor = new Author('jelmer', $link, $icon);
128 | $attachment->setAuthor($fullAuthor);
129 |
130 | $this->assertTrue(isset($attachment->get()['author_icon']));
131 | $this->assertEquals($icon, $attachment->get()['author_icon']);
132 | $this->assertContains('"author_icon":' . json_encode($icon), json_encode($attachment));
133 |
134 | $this->assertTrue(isset($attachment->get()['author_link']));
135 | $this->assertEquals($link, $attachment->get()['author_link']);
136 | $this->assertContains('"author_link":' . json_encode($link), json_encode($attachment));
137 | }
138 |
139 | public function testTitle()
140 | {
141 | $attachment = $this->getAttachment();
142 |
143 | $this->assertFalse(isset($attachment->get()['title_url']));
144 |
145 | $baseTitle = new Title('jelmer wrote this');
146 | $attachment->setTitle($baseTitle);
147 |
148 | $this->assertTrue(isset($attachment->get()['title']));
149 | $this->assertEquals($baseTitle, $attachment->get()['title']);
150 |
151 | $this->assertContains('"title":' . json_encode($baseTitle), json_encode($attachment));
152 |
153 | $link = new Url('http://pageon.be');
154 | $fullTitle = new Title('jelmer', $link);
155 | $attachment->setTitle($fullTitle);
156 |
157 | $this->assertTrue(isset($attachment->get()['title_link']));
158 | $this->assertEquals($link, $attachment->get()['title_link']);
159 | $this->assertContains('"title_link":' . json_encode($link), json_encode($attachment));
160 | }
161 |
162 | public function testField()
163 | {
164 | $attachment = $this->getAttachment();
165 |
166 | $this->assertFalse(isset($attachment->get()['fields']));
167 |
168 | $field = new Field('title', 'Jelmer wrote it');
169 | $attachment->addFields([$field, $field]);
170 |
171 | $attachmentArray = $attachment->get();
172 | $this->assertTrue(isset($attachmentArray['fields']));
173 | $this->assertEquals($field, $attachmentArray['fields'][0]);
174 |
175 | $this->assertContains('"fields":', json_encode($attachment));
176 | $this->assertContains(json_encode($field), json_encode($attachment));
177 | }
178 | }
179 |
--------------------------------------------------------------------------------
/tests/Unit/Slack/ChannelTest.php:
--------------------------------------------------------------------------------
1 | assertInstanceOf(
16 | 'Pageon\SlackWebhookMonolog\Slack\Interfaces\ChannelInterface',
17 | new Channel('#monolog'),
18 | "The class doesn't implement the ChannelInterface"
19 | );
20 | }
21 |
22 | /**
23 | * Do we actually get the channel back we put into the class?
24 | */
25 | public function testGetIcon()
26 | {
27 | $channelName = '#monolog';
28 | $channel = new Channel($channelName);
29 | $this->assertEquals($channelName, $channel->getChannel(), 'The channel name is not returned correctly');
30 | }
31 |
32 | /**
33 | * This will test the _toString implementation.
34 | */
35 | public function testToString()
36 | {
37 | $channelName = '#monolog';
38 | $channel = new Channel($channelName);
39 | $this->assertEquals(
40 | $channelName,
41 | $channel,
42 | 'When the Channel is cast to string it should return the channel name'
43 | );
44 | }
45 |
46 | /**
47 | * This will test if the whitespace around the channel name is trimmed.
48 | */
49 | public function testWhiteSpaceAroundChannelName()
50 | {
51 | $channelName = '#monolog';
52 | $this->assertEquals(
53 | $channelName,
54 | new Channel(' ' . $channelName),
55 | 'Whitespace before the channel name should be trimmed'
56 | );
57 | $this->assertEquals(
58 | $channelName,
59 | new Channel($channelName . ' '),
60 | 'Whitespace after the channel name should be trimmed'
61 | );
62 | $this->assertEquals(
63 | $channelName,
64 | new Channel(' ' . $channelName . ' '),
65 | 'Whitespace before and after the channel name should be trimmed'
66 | );
67 | }
68 |
69 | /**
70 | * This will test if there is an error when the channel name that is passed is not a channel or an account.
71 | */
72 | public function testChannelNameisNotAChannelOrAnAccount()
73 | {
74 | $this->setExpectedException('Pageon\SlackWebhookMonolog\Slack\Exceptions\InvalidChannelException', '', 400);
75 | new Channel('han solo');
76 | }
77 |
78 | /**
79 | * This will test if there is an error when the channel name that is passed is not a channel or an account.
80 | */
81 | public function testAccountTypeChannelNameCannotContainSpaces()
82 | {
83 | $this->setExpectedException('Pageon\SlackWebhookMonolog\Slack\Exceptions\InvalidChannelException', '', 400);
84 | new Channel('@dzaj azdadz');
85 | }
86 |
87 | /**
88 | * This will test if there is an error when the channel name that is passed is not a channel or an account.
89 | */
90 | public function testAccountTypeChannelNameCannotContainStrangeCharacters()
91 | {
92 | $this->setExpectedException('Pageon\SlackWebhookMonolog\Slack\Exceptions\InvalidChannelException', '', 400);
93 | new Channel('@dzaj~azdadz');
94 | }
95 |
96 | /**
97 | * This will test if there is an error when the channel name that is passed is not a channel or an account.
98 | */
99 | public function testAccountTypeChannelNameCannotBeEmpty()
100 | {
101 | $this->setExpectedException('Pageon\SlackWebhookMonolog\Slack\Exceptions\InvalidChannelException', '', 400);
102 | new Channel('@');
103 | }
104 |
105 | /**
106 | * This will test if there is an error when the channel name that is passed is not a channel or an account.
107 | */
108 | public function testAccountTypeChannelNameCannotBeLongerThan21Chars()
109 | {
110 | $this->setExpectedException('Pageon\SlackWebhookMonolog\Slack\Exceptions\InvalidChannelException', '', 400);
111 | new Channel('@azertyuiopqsdfghjklmwx');
112 | }
113 |
114 | /**
115 | * This will test if there is an error when the channel name that is passed is not a channel or an account.
116 | */
117 | public function testAccountTypeChannelNameCanBe21Chars()
118 | {
119 | $username = '@azertyuiopqsdfghj1_--';
120 | $this->assertEquals($username, new Channel($username));
121 | }
122 |
123 | /**
124 | * This will test if there is an error when the channel name that is passed is not a channel or an channel.
125 | */
126 | public function testChannelTypeChannelNameCannotContainSpaces()
127 | {
128 | $this->setExpectedException('Pageon\SlackWebhookMonolog\Slack\Exceptions\InvalidChannelException', '', 400);
129 | new Channel('#dzaj azdadz');
130 | }
131 |
132 | /**
133 | * This will test if there is an error when the channel name that is passed is not a channel or an channel.
134 | */
135 | public function testChannelTypeChannelNameCannotContainStrangeCharacters()
136 | {
137 | $this->setExpectedException('Pageon\SlackWebhookMonolog\Slack\Exceptions\InvalidChannelException', '', 400);
138 | new Channel('#dzaj~azdadz');
139 | }
140 |
141 | /**
142 | * This will test if there is an error when the channel name that is passed is not a channel or an channel.
143 | */
144 | public function testChannelTypeChannelNameCannotBeEmpty()
145 | {
146 | $this->setExpectedException('Pageon\SlackWebhookMonolog\Slack\Exceptions\InvalidChannelException', '', 400);
147 | new Channel('#');
148 | }
149 |
150 | /**
151 | * This will test if there is an error when the channel name that is passed is not a channel or an channel.
152 | */
153 | public function testChannelTypeChannelNameCannotBeCompletelyEmpty()
154 | {
155 | $this->setExpectedException('Pageon\SlackWebhookMonolog\Slack\Exceptions\InvalidChannelException', '', 400);
156 | new Channel('');
157 | }
158 |
159 | /**
160 | * This will test if there is an error when the channel name that is passed is not a channel or an channel.
161 | */
162 | public function testChannelTypeChannelNameCannotBeLongerThan21Chars()
163 | {
164 | $this->setExpectedException('Pageon\SlackWebhookMonolog\Slack\Exceptions\InvalidChannelException', '', 400);
165 | new Channel('#azertyuiopqsdfghjklmwx');
166 | }
167 |
168 | /**
169 | * This will test if there is an error when the channel name that is passed is not a channel or an channel.
170 | */
171 | public function testChannelTypeChannelNameCannotBe21Chars()
172 | {
173 | $username = '#azertyuiopqsdfghj1_-_';
174 | $this->assertEquals($username, new Channel($username));
175 | }
176 |
177 | /**
178 | * The return of the jsonSerialize function should match the toString implementation.
179 | */
180 | public function testJsonSerialize()
181 | {
182 | $channel = new Channel('@bob');
183 |
184 | $this->assertEquals((string) $channel, $channel->jsonSerialize());
185 | }
186 | }
187 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 3, 29 June 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 | Preamble
9 |
10 | The GNU General Public License is a free, copyleft license for
11 | software and other kinds of works.
12 |
13 | The licenses for most software and other practical works are designed
14 | to take away your freedom to share and change the works. By contrast,
15 | the GNU General Public License is intended to guarantee your freedom to
16 | share and change all versions of a program--to make sure it remains free
17 | software for all its users. We, the Free Software Foundation, use the
18 | GNU General Public License for most of our software; it applies also to
19 | any other work released this way by its authors. You can apply it to
20 | your programs, too.
21 |
22 | When we speak of free software, we are referring to freedom, not
23 | price. Our General Public Licenses are designed to make sure that you
24 | have the freedom to distribute copies of free software (and charge for
25 | them if you wish), that you receive source code or can get it if you
26 | want it, that you can change the software or use pieces of it in new
27 | free programs, and that you know you can do these things.
28 |
29 | To protect your rights, we need to prevent others from denying you
30 | these rights or asking you to surrender the rights. Therefore, you have
31 | certain responsibilities if you distribute copies of the software, or if
32 | you modify it: responsibilities to respect the freedom of others.
33 |
34 | For example, if you distribute copies of such a program, whether
35 | gratis or for a fee, you must pass on to the recipients the same
36 | freedoms that you received. You must make sure that they, too, receive
37 | or can get the source code. And you must show them these terms so they
38 | know their rights.
39 |
40 | Developers that use the GNU GPL protect your rights with two steps:
41 | (1) assert copyright on the software, and (2) offer you this License
42 | giving you legal permission to copy, distribute and/or modify it.
43 |
44 | For the developers' and authors' protection, the GPL clearly explains
45 | that there is no warranty for this free software. For both users' and
46 | authors' sake, the GPL requires that modified versions be marked as
47 | changed, so that their problems will not be attributed erroneously to
48 | authors of previous versions.
49 |
50 | Some devices are designed to deny users access to install or run
51 | modified versions of the software inside them, although the manufacturer
52 | can do so. This is fundamentally incompatible with the aim of
53 | protecting users' freedom to change the software. The systematic
54 | pattern of such abuse occurs in the area of products for individuals to
55 | use, which is precisely where it is most unacceptable. Therefore, we
56 | have designed this version of the GPL to prohibit the practice for those
57 | products. If such problems arise substantially in other domains, we
58 | stand ready to extend this provision to those domains in future versions
59 | of the GPL, as needed to protect the freedom of users.
60 |
61 | Finally, every program is threatened constantly by software patents.
62 | States should not allow patents to restrict development and use of
63 | software on general-purpose computers, but in those that do, we wish to
64 | avoid the special danger that patents applied to a free program could
65 | make it effectively proprietary. To prevent this, the GPL assures that
66 | patents cannot be used to render the program non-free.
67 |
68 | The precise terms and conditions for copying, distribution and
69 | modification follow.
70 |
71 | TERMS AND CONDITIONS
72 |
73 | 0. Definitions.
74 |
75 | "This License" refers to version 3 of the GNU General Public License.
76 |
77 | "Copyright" also means copyright-like laws that apply to other kinds of
78 | works, such as semiconductor masks.
79 |
80 | "The Program" refers to any copyrightable work licensed under this
81 | License. Each licensee is addressed as "you". "Licensees" and
82 | "recipients" may be individuals or organizations.
83 |
84 | To "modify" a work means to copy from or adapt all or part of the work
85 | in a fashion requiring copyright permission, other than the making of an
86 | exact copy. The resulting work is called a "modified version" of the
87 | earlier work or a work "based on" the earlier work.
88 |
89 | A "covered work" means either the unmodified Program or a work based
90 | on the Program.
91 |
92 | To "propagate" a work means to do anything with it that, without
93 | permission, would make you directly or secondarily liable for
94 | infringement under applicable copyright law, except executing it on a
95 | computer or modifying a private copy. Propagation includes copying,
96 | distribution (with or without modification), making available to the
97 | public, and in some countries other activities as well.
98 |
99 | To "convey" a work means any kind of propagation that enables other
100 | parties to make or receive copies. Mere interaction with a user through
101 | a computer network, with no transfer of a copy, is not conveying.
102 |
103 | An interactive user interface displays "Appropriate Legal Notices"
104 | to the extent that it includes a convenient and prominently visible
105 | feature that (1) displays an appropriate copyright notice, and (2)
106 | tells the user that there is no warranty for the work (except to the
107 | extent that warranties are provided), that licensees may convey the
108 | work under this License, and how to view a copy of this License. If
109 | the interface presents a list of user commands or options, such as a
110 | menu, a prominent item in the list meets this criterion.
111 |
112 | 1. Source Code.
113 |
114 | The "source code" for a work means the preferred form of the work
115 | for making modifications to it. "Object code" means any non-source
116 | form of a work.
117 |
118 | A "Standard Interface" means an interface that either is an official
119 | standard defined by a recognized standards body, or, in the case of
120 | interfaces specified for a particular programming language, one that
121 | is widely used among developers working in that language.
122 |
123 | The "System Libraries" of an executable work include anything, other
124 | than the work as a whole, that (a) is included in the normal form of
125 | packaging a Major Component, but which is not part of that Major
126 | Component, and (b) serves only to enable use of the work with that
127 | Major Component, or to implement a Standard Interface for which an
128 | implementation is available to the public in source code form. A
129 | "Major Component", in this context, means a major essential component
130 | (kernel, window system, and so on) of the specific operating system
131 | (if any) on which the executable work runs, or a compiler used to
132 | produce the work, or an object code interpreter used to run it.
133 |
134 | The "Corresponding Source" for a work in object code form means all
135 | the source code needed to generate, install, and (for an executable
136 | work) run the object code and to modify the work, including scripts to
137 | control those activities. However, it does not include the work's
138 | System Libraries, or general-purpose tools or generally available free
139 | programs which are used unmodified in performing those activities but
140 | which are not part of the work. For example, Corresponding Source
141 | includes interface definition files associated with source files for
142 | the work, and the source code for shared libraries and dynamically
143 | linked subprograms that the work is specifically designed to require,
144 | such as by intimate data communication or control flow between those
145 | subprograms and other parts of the work.
146 |
147 | The Corresponding Source need not include anything that users
148 | can regenerate automatically from other parts of the Corresponding
149 | Source.
150 |
151 | The Corresponding Source for a work in source code form is that
152 | same work.
153 |
154 | 2. Basic Permissions.
155 |
156 | All rights granted under this License are granted for the term of
157 | copyright on the Program, and are irrevocable provided the stated
158 | conditions are met. This License explicitly affirms your unlimited
159 | permission to run the unmodified Program. The output from running a
160 | covered work is covered by this License only if the output, given its
161 | content, constitutes a covered work. This License acknowledges your
162 | rights of fair use or other equivalent, as provided by copyright law.
163 |
164 | You may make, run and propagate covered works that you do not
165 | convey, without conditions so long as your license otherwise remains
166 | in force. You may convey covered works to others for the sole purpose
167 | of having them make modifications exclusively for you, or provide you
168 | with facilities for running those works, provided that you comply with
169 | the terms of this License in conveying all material for which you do
170 | not control copyright. Those thus making or running the covered works
171 | for you must do so exclusively on your behalf, under your direction
172 | and control, on terms that prohibit them from making any copies of
173 | your copyrighted material outside their relationship with you.
174 |
175 | Conveying under any other circumstances is permitted solely under
176 | the conditions stated below. Sublicensing is not allowed; section 10
177 | makes it unnecessary.
178 |
179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180 |
181 | No covered work shall be deemed part of an effective technological
182 | measure under any applicable law fulfilling obligations under article
183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184 | similar laws prohibiting or restricting circumvention of such
185 | measures.
186 |
187 | When you convey a covered work, you waive any legal power to forbid
188 | circumvention of technological measures to the extent such circumvention
189 | is effected by exercising rights under this License with respect to
190 | the covered work, and you disclaim any intention to limit operation or
191 | modification of the work as a means of enforcing, against the work's
192 | users, your or third parties' legal rights to forbid circumvention of
193 | technological measures.
194 |
195 | 4. Conveying Verbatim Copies.
196 |
197 | You may convey verbatim copies of the Program's source code as you
198 | receive it, in any medium, provided that you conspicuously and
199 | appropriately publish on each copy an appropriate copyright notice;
200 | keep intact all notices stating that this License and any
201 | non-permissive terms added in accord with section 7 apply to the code;
202 | keep intact all notices of the absence of any warranty; and give all
203 | recipients a copy of this License along with the Program.
204 |
205 | You may charge any price or no price for each copy that you convey,
206 | and you may offer support or warranty protection for a fee.
207 |
208 | 5. Conveying Modified Source Versions.
209 |
210 | You may convey a work based on the Program, or the modifications to
211 | produce it from the Program, in the form of source code under the
212 | terms of section 4, provided that you also meet all of these conditions:
213 |
214 | a) The work must carry prominent notices stating that you modified
215 | it, and giving a relevant date.
216 |
217 | b) The work must carry prominent notices stating that it is
218 | released under this License and any conditions added under section
219 | 7. This requirement modifies the requirement in section 4 to
220 | "keep intact all notices".
221 |
222 | c) You must license the entire work, as a whole, under this
223 | License to anyone who comes into possession of a copy. This
224 | License will therefore apply, along with any applicable section 7
225 | additional terms, to the whole of the work, and all its parts,
226 | regardless of how they are packaged. This License gives no
227 | permission to license the work in any other way, but it does not
228 | invalidate such permission if you have separately received it.
229 |
230 | d) If the work has interactive user interfaces, each must display
231 | Appropriate Legal Notices; however, if the Program has interactive
232 | interfaces that do not display Appropriate Legal Notices, your
233 | work need not make them do so.
234 |
235 | A compilation of a covered work with other separate and independent
236 | works, which are not by their nature extensions of the covered work,
237 | and which are not combined with it such as to form a larger program,
238 | in or on a volume of a storage or distribution medium, is called an
239 | "aggregate" if the compilation and its resulting copyright are not
240 | used to limit the access or legal rights of the compilation's users
241 | beyond what the individual works permit. Inclusion of a covered work
242 | in an aggregate does not cause this License to apply to the other
243 | parts of the aggregate.
244 |
245 | 6. Conveying Non-Source Forms.
246 |
247 | You may convey a covered work in object code form under the terms
248 | of sections 4 and 5, provided that you also convey the
249 | machine-readable Corresponding Source under the terms of this License,
250 | in one of these ways:
251 |
252 | a) Convey the object code in, or embodied in, a physical product
253 | (including a physical distribution medium), accompanied by the
254 | Corresponding Source fixed on a durable physical medium
255 | customarily used for software interchange.
256 |
257 | b) Convey the object code in, or embodied in, a physical product
258 | (including a physical distribution medium), accompanied by a
259 | written offer, valid for at least three years and valid for as
260 | long as you offer spare parts or customer support for that product
261 | model, to give anyone who possesses the object code either (1) a
262 | copy of the Corresponding Source for all the software in the
263 | product that is covered by this License, on a durable physical
264 | medium customarily used for software interchange, for a price no
265 | more than your reasonable cost of physically performing this
266 | conveying of source, or (2) access to copy the
267 | Corresponding Source from a network server at no charge.
268 |
269 | c) Convey individual copies of the object code with a copy of the
270 | written offer to provide the Corresponding Source. This
271 | alternative is allowed only occasionally and noncommercially, and
272 | only if you received the object code with such an offer, in accord
273 | with subsection 6b.
274 |
275 | d) Convey the object code by offering access from a designated
276 | place (gratis or for a charge), and offer equivalent access to the
277 | Corresponding Source in the same way through the same place at no
278 | further charge. You need not require recipients to copy the
279 | Corresponding Source along with the object code. If the place to
280 | copy the object code is a network server, the Corresponding Source
281 | may be on a different server (operated by you or a third party)
282 | that supports equivalent copying facilities, provided you maintain
283 | clear directions next to the object code saying where to find the
284 | Corresponding Source. Regardless of what server hosts the
285 | Corresponding Source, you remain obligated to ensure that it is
286 | available for as long as needed to satisfy these requirements.
287 |
288 | e) Convey the object code using peer-to-peer transmission, provided
289 | you inform other peers where the object code and Corresponding
290 | Source of the work are being offered to the general public at no
291 | charge under subsection 6d.
292 |
293 | A separable portion of the object code, whose source code is excluded
294 | from the Corresponding Source as a System Library, need not be
295 | included in conveying the object code work.
296 |
297 | A "User Product" is either (1) a "consumer product", which means any
298 | tangible personal property which is normally used for personal, family,
299 | or household purposes, or (2) anything designed or sold for incorporation
300 | into a dwelling. In determining whether a product is a consumer product,
301 | doubtful cases shall be resolved in favor of coverage. For a particular
302 | product received by a particular user, "normally used" refers to a
303 | typical or common use of that class of product, regardless of the status
304 | of the particular user or of the way in which the particular user
305 | actually uses, or expects or is expected to use, the product. A product
306 | is a consumer product regardless of whether the product has substantial
307 | commercial, industrial or non-consumer uses, unless such uses represent
308 | the only significant mode of use of the product.
309 |
310 | "Installation Information" for a User Product means any methods,
311 | procedures, authorization keys, or other information required to install
312 | and execute modified versions of a covered work in that User Product from
313 | a modified version of its Corresponding Source. The information must
314 | suffice to ensure that the continued functioning of the modified object
315 | code is in no case prevented or interfered with solely because
316 | modification has been made.
317 |
318 | If you convey an object code work under this section in, or with, or
319 | specifically for use in, a User Product, and the conveying occurs as
320 | part of a transaction in which the right of possession and use of the
321 | User Product is transferred to the recipient in perpetuity or for a
322 | fixed term (regardless of how the transaction is characterized), the
323 | Corresponding Source conveyed under this section must be accompanied
324 | by the Installation Information. But this requirement does not apply
325 | if neither you nor any third party retains the ability to install
326 | modified object code on the User Product (for example, the work has
327 | been installed in ROM).
328 |
329 | The requirement to provide Installation Information does not include a
330 | requirement to continue to provide support service, warranty, or updates
331 | for a work that has been modified or installed by the recipient, or for
332 | the User Product in which it has been modified or installed. Access to a
333 | network may be denied when the modification itself materially and
334 | adversely affects the operation of the network or violates the rules and
335 | protocols for communication across the network.
336 |
337 | Corresponding Source conveyed, and Installation Information provided,
338 | in accord with this section must be in a format that is publicly
339 | documented (and with an implementation available to the public in
340 | source code form), and must require no special password or key for
341 | unpacking, reading or copying.
342 |
343 | 7. Additional Terms.
344 |
345 | "Additional permissions" are terms that supplement the terms of this
346 | License by making exceptions from one or more of its conditions.
347 | Additional permissions that are applicable to the entire Program shall
348 | be treated as though they were included in this License, to the extent
349 | that they are valid under applicable law. If additional permissions
350 | apply only to part of the Program, that part may be used separately
351 | under those permissions, but the entire Program remains governed by
352 | this License without regard to the additional permissions.
353 |
354 | When you convey a copy of a covered work, you may at your option
355 | remove any additional permissions from that copy, or from any part of
356 | it. (Additional permissions may be written to require their own
357 | removal in certain cases when you modify the work.) You may place
358 | additional permissions on material, added by you to a covered work,
359 | for which you have or can give appropriate copyright permission.
360 |
361 | Notwithstanding any other provision of this License, for material you
362 | add to a covered work, you may (if authorized by the copyright holders of
363 | that material) supplement the terms of this License with terms:
364 |
365 | a) Disclaiming warranty or limiting liability differently from the
366 | terms of sections 15 and 16 of this License; or
367 |
368 | b) Requiring preservation of specified reasonable legal notices or
369 | author attributions in that material or in the Appropriate Legal
370 | Notices displayed by works containing it; or
371 |
372 | c) Prohibiting misrepresentation of the origin of that material, or
373 | requiring that modified versions of such material be marked in
374 | reasonable ways as different from the original version; or
375 |
376 | d) Limiting the use for publicity purposes of names of licensors or
377 | authors of the material; or
378 |
379 | e) Declining to grant rights under trademark law for use of some
380 | trade names, trademarks, or service marks; or
381 |
382 | f) Requiring indemnification of licensors and authors of that
383 | material by anyone who conveys the material (or modified versions of
384 | it) with contractual assumptions of liability to the recipient, for
385 | any liability that these contractual assumptions directly impose on
386 | those licensors and authors.
387 |
388 | All other non-permissive additional terms are considered "further
389 | restrictions" within the meaning of section 10. If the Program as you
390 | received it, or any part of it, contains a notice stating that it is
391 | governed by this License along with a term that is a further
392 | restriction, you may remove that term. If a license document contains
393 | a further restriction but permits relicensing or conveying under this
394 | License, you may add to a covered work material governed by the terms
395 | of that license document, provided that the further restriction does
396 | not survive such relicensing or conveying.
397 |
398 | If you add terms to a covered work in accord with this section, you
399 | must place, in the relevant source files, a statement of the
400 | additional terms that apply to those files, or a notice indicating
401 | where to find the applicable terms.
402 |
403 | Additional terms, permissive or non-permissive, may be stated in the
404 | form of a separately written license, or stated as exceptions;
405 | the above requirements apply either way.
406 |
407 | 8. Termination.
408 |
409 | You may not propagate or modify a covered work except as expressly
410 | provided under this License. Any attempt otherwise to propagate or
411 | modify it is void, and will automatically terminate your rights under
412 | this License (including any patent licenses granted under the third
413 | paragraph of section 11).
414 |
415 | However, if you cease all violation of this License, then your
416 | license from a particular copyright holder is reinstated (a)
417 | provisionally, unless and until the copyright holder explicitly and
418 | finally terminates your license, and (b) permanently, if the copyright
419 | holder fails to notify you of the violation by some reasonable means
420 | prior to 60 days after the cessation.
421 |
422 | Moreover, your license from a particular copyright holder is
423 | reinstated permanently if the copyright holder notifies you of the
424 | violation by some reasonable means, this is the first time you have
425 | received notice of violation of this License (for any work) from that
426 | copyright holder, and you cure the violation prior to 30 days after
427 | your receipt of the notice.
428 |
429 | Termination of your rights under this section does not terminate the
430 | licenses of parties who have received copies or rights from you under
431 | this License. If your rights have been terminated and not permanently
432 | reinstated, you do not qualify to receive new licenses for the same
433 | material under section 10.
434 |
435 | 9. Acceptance Not Required for Having Copies.
436 |
437 | You are not required to accept this License in order to receive or
438 | run a copy of the Program. Ancillary propagation of a covered work
439 | occurring solely as a consequence of using peer-to-peer transmission
440 | to receive a copy likewise does not require acceptance. However,
441 | nothing other than this License grants you permission to propagate or
442 | modify any covered work. These actions infringe copyright if you do
443 | not accept this License. Therefore, by modifying or propagating a
444 | covered work, you indicate your acceptance of this License to do so.
445 |
446 | 10. Automatic Licensing of Downstream Recipients.
447 |
448 | Each time you convey a covered work, the recipient automatically
449 | receives a license from the original licensors, to run, modify and
450 | propagate that work, subject to this License. You are not responsible
451 | for enforcing compliance by third parties with this License.
452 |
453 | An "entity transaction" is a transaction transferring control of an
454 | organization, or substantially all assets of one, or subdividing an
455 | organization, or merging organizations. If propagation of a covered
456 | work results from an entity transaction, each party to that
457 | transaction who receives a copy of the work also receives whatever
458 | licenses to the work the party's predecessor in interest had or could
459 | give under the previous paragraph, plus a right to possession of the
460 | Corresponding Source of the work from the predecessor in interest, if
461 | the predecessor has it or can get it with reasonable efforts.
462 |
463 | You may not impose any further restrictions on the exercise of the
464 | rights granted or affirmed under this License. For example, you may
465 | not impose a license fee, royalty, or other charge for exercise of
466 | rights granted under this License, and you may not initiate litigation
467 | (including a cross-claim or counterclaim in a lawsuit) alleging that
468 | any patent claim is infringed by making, using, selling, offering for
469 | sale, or importing the Program or any portion of it.
470 |
471 | 11. Patents.
472 |
473 | A "contributor" is a copyright holder who authorizes use under this
474 | License of the Program or a work on which the Program is based. The
475 | work thus licensed is called the contributor's "contributor version".
476 |
477 | A contributor's "essential patent claims" are all patent claims
478 | owned or controlled by the contributor, whether already acquired or
479 | hereafter acquired, that would be infringed by some manner, permitted
480 | by this License, of making, using, or selling its contributor version,
481 | but do not include claims that would be infringed only as a
482 | consequence of further modification of the contributor version. For
483 | purposes of this definition, "control" includes the right to grant
484 | patent sublicenses in a manner consistent with the requirements of
485 | this License.
486 |
487 | Each contributor grants you a non-exclusive, worldwide, royalty-free
488 | patent license under the contributor's essential patent claims, to
489 | make, use, sell, offer for sale, import and otherwise run, modify and
490 | propagate the contents of its contributor version.
491 |
492 | In the following three paragraphs, a "patent license" is any express
493 | agreement or commitment, however denominated, not to enforce a patent
494 | (such as an express permission to practice a patent or covenant not to
495 | sue for patent infringement). To "grant" such a patent license to a
496 | party means to make such an agreement or commitment not to enforce a
497 | patent against the party.
498 |
499 | If you convey a covered work, knowingly relying on a patent license,
500 | and the Corresponding Source of the work is not available for anyone
501 | to copy, free of charge and under the terms of this License, through a
502 | publicly available network server or other readily accessible means,
503 | then you must either (1) cause the Corresponding Source to be so
504 | available, or (2) arrange to deprive yourself of the benefit of the
505 | patent license for this particular work, or (3) arrange, in a manner
506 | consistent with the requirements of this License, to extend the patent
507 | license to downstream recipients. "Knowingly relying" means you have
508 | actual knowledge that, but for the patent license, your conveying the
509 | covered work in a country, or your recipient's use of the covered work
510 | in a country, would infringe one or more identifiable patents in that
511 | country that you have reason to believe are valid.
512 |
513 | If, pursuant to or in connection with a single transaction or
514 | arrangement, you convey, or propagate by procuring conveyance of, a
515 | covered work, and grant a patent license to some of the parties
516 | receiving the covered work authorizing them to use, propagate, modify
517 | or convey a specific copy of the covered work, then the patent license
518 | you grant is automatically extended to all recipients of the covered
519 | work and works based on it.
520 |
521 | A patent license is "discriminatory" if it does not include within
522 | the scope of its coverage, prohibits the exercise of, or is
523 | conditioned on the non-exercise of one or more of the rights that are
524 | specifically granted under this License. You may not convey a covered
525 | work if you are a party to an arrangement with a third party that is
526 | in the business of distributing software, under which you make payment
527 | to the third party based on the extent of your activity of conveying
528 | the work, and under which the third party grants, to any of the
529 | parties who would receive the covered work from you, a discriminatory
530 | patent license (a) in connection with copies of the covered work
531 | conveyed by you (or copies made from those copies), or (b) primarily
532 | for and in connection with specific products or compilations that
533 | contain the covered work, unless you entered into that arrangement,
534 | or that patent license was granted, prior to 28 March 2007.
535 |
536 | Nothing in this License shall be construed as excluding or limiting
537 | any implied license or other defenses to infringement that may
538 | otherwise be available to you under applicable patent law.
539 |
540 | 12. No Surrender of Others' Freedom.
541 |
542 | If conditions are imposed on you (whether by court order, agreement or
543 | otherwise) that contradict the conditions of this License, they do not
544 | excuse you from the conditions of this License. If you cannot convey a
545 | covered work so as to satisfy simultaneously your obligations under this
546 | License and any other pertinent obligations, then as a consequence you may
547 | not convey it at all. For example, if you agree to terms that obligate you
548 | to collect a royalty for further conveying from those to whom you convey
549 | the Program, the only way you could satisfy both those terms and this
550 | License would be to refrain entirely from conveying the Program.
551 |
552 | 13. Use with the GNU Affero General Public License.
553 |
554 | Notwithstanding any other provision of this License, you have
555 | permission to link or combine any covered work with a work licensed
556 | under version 3 of the GNU Affero General Public License into a single
557 | combined work, and to convey the resulting work. The terms of this
558 | License will continue to apply to the part which is the covered work,
559 | but the special requirements of the GNU Affero General Public License,
560 | section 13, concerning interaction through a network will apply to the
561 | combination as such.
562 |
563 | 14. Revised Versions of this License.
564 |
565 | The Free Software Foundation may publish revised and/or new versions of
566 | the GNU General Public License from time to time. Such new versions will
567 | be similar in spirit to the present version, but may differ in detail to
568 | address new problems or concerns.
569 |
570 | Each version is given a distinguishing version number. If the
571 | Program specifies that a certain numbered version of the GNU General
572 | Public License "or any later version" applies to it, you have the
573 | option of following the terms and conditions either of that numbered
574 | version or of any later version published by the Free Software
575 | Foundation. If the Program does not specify a version number of the
576 | GNU General Public License, you may choose any version ever published
577 | by the Free Software Foundation.
578 |
579 | If the Program specifies that a proxy can decide which future
580 | versions of the GNU General Public License can be used, that proxy's
581 | public statement of acceptance of a version permanently authorizes you
582 | to choose that version for the Program.
583 |
584 | Later license versions may give you additional or different
585 | permissions. However, no additional obligations are imposed on any
586 | author or copyright holder as a result of your choosing to follow a
587 | later version.
588 |
589 | 15. Disclaimer of Warranty.
590 |
591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599 |
600 | 16. Limitation of Liability.
601 |
602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610 | SUCH DAMAGES.
611 |
612 | 17. Interpretation of Sections 15 and 16.
613 |
614 | If the disclaimer of warranty and limitation of liability provided
615 | above cannot be given local legal effect according to their terms,
616 | reviewing courts shall apply local law that most closely approximates
617 | an absolute waiver of all civil liability in connection with the
618 | Program, unless a warranty or assumption of liability accompanies a
619 | copy of the Program in return for a fee.
620 |
621 | END OF TERMS AND CONDITIONS
622 |
623 | How to Apply These Terms to Your New Programs
624 |
625 | If you develop a new program, and you want it to be of the greatest
626 | possible use to the public, the best way to achieve this is to make it
627 | free software which everyone can redistribute and change under these terms.
628 |
629 | To do so, attach the following notices to the program. It is safest
630 | to attach them to the start of each source file to most effectively
631 | state the exclusion of warranty; and each file should have at least
632 | the "copyright" line and a pointer to where the full notice is found.
633 |
634 | {one line to give the program's name and a brief idea of what it does.}
635 | Copyright (C) {year} {name of author}
636 |
637 | This program is free software: you can redistribute it and/or modify
638 | it under the terms of the GNU General Public License as published by
639 | the Free Software Foundation, either version 3 of the License, or
640 | (at your option) any later version.
641 |
642 | This program is distributed in the hope that it will be useful,
643 | but WITHOUT ANY WARRANTY; without even the implied warranty of
644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645 | GNU General Public License for more details.
646 |
647 | You should have received a copy of the GNU General Public License
648 | along with this program. If not, see .
649 |
650 | Also add information on how to contact you by electronic and paper mail.
651 |
652 | If the program does terminal interaction, make it output a short
653 | notice like this when it starts in an interactive mode:
654 |
655 | {project} Copyright (C) {year} {fullname}
656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657 | This is free software, and you are welcome to redistribute it
658 | under certain conditions; type `show c' for details.
659 |
660 | The hypothetical commands `show w' and `show c' should show the appropriate
661 | parts of the General Public License. Of course, your program's commands
662 | might be different; for a GUI interface, you would use an "about box".
663 |
664 | You should also get your employer (if you work as a programmer) or school,
665 | if any, to sign a "copyright disclaimer" for the program, if necessary.
666 | For more information on this, and how to apply and follow the GNU GPL, see
667 | .
668 |
669 | The GNU General Public License does not permit incorporating your program
670 | into proprietary programs. If your program is a subroutine library, you
671 | may consider it more useful to permit linking proprietary applications with
672 | the library. If this is what you want to do, use the GNU Lesser General
673 | Public License instead of this License. But first, please read
674 | .
675 |
--------------------------------------------------------------------------------
/composer.lock:
--------------------------------------------------------------------------------
1 | {
2 | "_readme": [
3 | "This file locks the dependencies of your project to a known state",
4 | "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
5 | "This file is @generated automatically"
6 | ],
7 | "hash": "dd6b43a3884fe5f184bc57f70b07111a",
8 | "content-hash": "afe4d0c04f502634e165935045cd7073",
9 | "packages": [
10 | {
11 | "name": "monolog/monolog",
12 | "version": "1.17.2",
13 | "source": {
14 | "type": "git",
15 | "url": "https://github.com/Seldaek/monolog.git",
16 | "reference": "bee7f0dc9c3e0b69a6039697533dca1e845c8c24"
17 | },
18 | "dist": {
19 | "type": "zip",
20 | "url": "https://api.github.com/repos/Seldaek/monolog/zipball/bee7f0dc9c3e0b69a6039697533dca1e845c8c24",
21 | "reference": "bee7f0dc9c3e0b69a6039697533dca1e845c8c24",
22 | "shasum": ""
23 | },
24 | "require": {
25 | "php": ">=5.3.0",
26 | "psr/log": "~1.0"
27 | },
28 | "provide": {
29 | "psr/log-implementation": "1.0.0"
30 | },
31 | "require-dev": {
32 | "aws/aws-sdk-php": "^2.4.9",
33 | "doctrine/couchdb": "~1.0@dev",
34 | "graylog2/gelf-php": "~1.0",
35 | "jakub-onderka/php-parallel-lint": "0.9",
36 | "php-console/php-console": "^3.1.3",
37 | "phpunit/phpunit": "~4.5",
38 | "phpunit/phpunit-mock-objects": "2.3.0",
39 | "raven/raven": "^0.13",
40 | "ruflin/elastica": ">=0.90 <3.0",
41 | "swiftmailer/swiftmailer": "~5.3",
42 | "videlalvaro/php-amqplib": "~2.4"
43 | },
44 | "suggest": {
45 | "aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB",
46 | "doctrine/couchdb": "Allow sending log messages to a CouchDB server",
47 | "ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)",
48 | "ext-mongo": "Allow sending log messages to a MongoDB server",
49 | "graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server",
50 | "php-console/php-console": "Allow sending log messages to Google Chrome",
51 | "raven/raven": "Allow sending log messages to a Sentry server",
52 | "rollbar/rollbar": "Allow sending log messages to Rollbar",
53 | "ruflin/elastica": "Allow sending log messages to an Elastic Search server",
54 | "videlalvaro/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib"
55 | },
56 | "type": "library",
57 | "extra": {
58 | "branch-alias": {
59 | "dev-master": "1.16.x-dev"
60 | }
61 | },
62 | "autoload": {
63 | "psr-4": {
64 | "Monolog\\": "src/Monolog"
65 | }
66 | },
67 | "notification-url": "https://packagist.org/downloads/",
68 | "license": [
69 | "MIT"
70 | ],
71 | "authors": [
72 | {
73 | "name": "Jordi Boggiano",
74 | "email": "j.boggiano@seld.be",
75 | "homepage": "http://seld.be"
76 | }
77 | ],
78 | "description": "Sends your logs to files, sockets, inboxes, databases and various web services",
79 | "homepage": "http://github.com/Seldaek/monolog",
80 | "keywords": [
81 | "log",
82 | "logging",
83 | "psr-3"
84 | ],
85 | "time": "2015-10-14 12:51:02"
86 | },
87 | {
88 | "name": "psr/log",
89 | "version": "1.0.0",
90 | "source": {
91 | "type": "git",
92 | "url": "https://github.com/php-fig/log.git",
93 | "reference": "fe0936ee26643249e916849d48e3a51d5f5e278b"
94 | },
95 | "dist": {
96 | "type": "zip",
97 | "url": "https://api.github.com/repos/php-fig/log/zipball/fe0936ee26643249e916849d48e3a51d5f5e278b",
98 | "reference": "fe0936ee26643249e916849d48e3a51d5f5e278b",
99 | "shasum": ""
100 | },
101 | "type": "library",
102 | "autoload": {
103 | "psr-0": {
104 | "Psr\\Log\\": ""
105 | }
106 | },
107 | "notification-url": "https://packagist.org/downloads/",
108 | "license": [
109 | "MIT"
110 | ],
111 | "authors": [
112 | {
113 | "name": "PHP-FIG",
114 | "homepage": "http://www.php-fig.org/"
115 | }
116 | ],
117 | "description": "Common interface for logging libraries",
118 | "keywords": [
119 | "log",
120 | "psr",
121 | "psr-3"
122 | ],
123 | "time": "2012-12-21 11:40:51"
124 | }
125 | ],
126 | "packages-dev": [
127 | {
128 | "name": "doctrine/instantiator",
129 | "version": "1.0.5",
130 | "source": {
131 | "type": "git",
132 | "url": "https://github.com/doctrine/instantiator.git",
133 | "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d"
134 | },
135 | "dist": {
136 | "type": "zip",
137 | "url": "https://api.github.com/repos/doctrine/instantiator/zipball/8e884e78f9f0eb1329e445619e04456e64d8051d",
138 | "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d",
139 | "shasum": ""
140 | },
141 | "require": {
142 | "php": ">=5.3,<8.0-DEV"
143 | },
144 | "require-dev": {
145 | "athletic/athletic": "~0.1.8",
146 | "ext-pdo": "*",
147 | "ext-phar": "*",
148 | "phpunit/phpunit": "~4.0",
149 | "squizlabs/php_codesniffer": "~2.0"
150 | },
151 | "type": "library",
152 | "extra": {
153 | "branch-alias": {
154 | "dev-master": "1.0.x-dev"
155 | }
156 | },
157 | "autoload": {
158 | "psr-4": {
159 | "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/"
160 | }
161 | },
162 | "notification-url": "https://packagist.org/downloads/",
163 | "license": [
164 | "MIT"
165 | ],
166 | "authors": [
167 | {
168 | "name": "Marco Pivetta",
169 | "email": "ocramius@gmail.com",
170 | "homepage": "http://ocramius.github.com/"
171 | }
172 | ],
173 | "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors",
174 | "homepage": "https://github.com/doctrine/instantiator",
175 | "keywords": [
176 | "constructor",
177 | "instantiate"
178 | ],
179 | "time": "2015-06-14 21:17:01"
180 | },
181 | {
182 | "name": "phpdocumentor/reflection-docblock",
183 | "version": "2.0.4",
184 | "source": {
185 | "type": "git",
186 | "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git",
187 | "reference": "d68dbdc53dc358a816f00b300704702b2eaff7b8"
188 | },
189 | "dist": {
190 | "type": "zip",
191 | "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/d68dbdc53dc358a816f00b300704702b2eaff7b8",
192 | "reference": "d68dbdc53dc358a816f00b300704702b2eaff7b8",
193 | "shasum": ""
194 | },
195 | "require": {
196 | "php": ">=5.3.3"
197 | },
198 | "require-dev": {
199 | "phpunit/phpunit": "~4.0"
200 | },
201 | "suggest": {
202 | "dflydev/markdown": "~1.0",
203 | "erusev/parsedown": "~1.0"
204 | },
205 | "type": "library",
206 | "extra": {
207 | "branch-alias": {
208 | "dev-master": "2.0.x-dev"
209 | }
210 | },
211 | "autoload": {
212 | "psr-0": {
213 | "phpDocumentor": [
214 | "src/"
215 | ]
216 | }
217 | },
218 | "notification-url": "https://packagist.org/downloads/",
219 | "license": [
220 | "MIT"
221 | ],
222 | "authors": [
223 | {
224 | "name": "Mike van Riel",
225 | "email": "mike.vanriel@naenius.com"
226 | }
227 | ],
228 | "time": "2015-02-03 12:10:50"
229 | },
230 | {
231 | "name": "phpspec/prophecy",
232 | "version": "v1.5.0",
233 | "source": {
234 | "type": "git",
235 | "url": "https://github.com/phpspec/prophecy.git",
236 | "reference": "4745ded9307786b730d7a60df5cb5a6c43cf95f7"
237 | },
238 | "dist": {
239 | "type": "zip",
240 | "url": "https://api.github.com/repos/phpspec/prophecy/zipball/4745ded9307786b730d7a60df5cb5a6c43cf95f7",
241 | "reference": "4745ded9307786b730d7a60df5cb5a6c43cf95f7",
242 | "shasum": ""
243 | },
244 | "require": {
245 | "doctrine/instantiator": "^1.0.2",
246 | "phpdocumentor/reflection-docblock": "~2.0",
247 | "sebastian/comparator": "~1.1"
248 | },
249 | "require-dev": {
250 | "phpspec/phpspec": "~2.0"
251 | },
252 | "type": "library",
253 | "extra": {
254 | "branch-alias": {
255 | "dev-master": "1.4.x-dev"
256 | }
257 | },
258 | "autoload": {
259 | "psr-0": {
260 | "Prophecy\\": "src/"
261 | }
262 | },
263 | "notification-url": "https://packagist.org/downloads/",
264 | "license": [
265 | "MIT"
266 | ],
267 | "authors": [
268 | {
269 | "name": "Konstantin Kudryashov",
270 | "email": "ever.zet@gmail.com",
271 | "homepage": "http://everzet.com"
272 | },
273 | {
274 | "name": "Marcello Duarte",
275 | "email": "marcello.duarte@gmail.com"
276 | }
277 | ],
278 | "description": "Highly opinionated mocking framework for PHP 5.3+",
279 | "homepage": "https://github.com/phpspec/prophecy",
280 | "keywords": [
281 | "Double",
282 | "Dummy",
283 | "fake",
284 | "mock",
285 | "spy",
286 | "stub"
287 | ],
288 | "time": "2015-08-13 10:07:40"
289 | },
290 | {
291 | "name": "phpunit/php-code-coverage",
292 | "version": "2.2.4",
293 | "source": {
294 | "type": "git",
295 | "url": "https://github.com/sebastianbergmann/php-code-coverage.git",
296 | "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979"
297 | },
298 | "dist": {
299 | "type": "zip",
300 | "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/eabf68b476ac7d0f73793aada060f1c1a9bf8979",
301 | "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979",
302 | "shasum": ""
303 | },
304 | "require": {
305 | "php": ">=5.3.3",
306 | "phpunit/php-file-iterator": "~1.3",
307 | "phpunit/php-text-template": "~1.2",
308 | "phpunit/php-token-stream": "~1.3",
309 | "sebastian/environment": "^1.3.2",
310 | "sebastian/version": "~1.0"
311 | },
312 | "require-dev": {
313 | "ext-xdebug": ">=2.1.4",
314 | "phpunit/phpunit": "~4"
315 | },
316 | "suggest": {
317 | "ext-dom": "*",
318 | "ext-xdebug": ">=2.2.1",
319 | "ext-xmlwriter": "*"
320 | },
321 | "type": "library",
322 | "extra": {
323 | "branch-alias": {
324 | "dev-master": "2.2.x-dev"
325 | }
326 | },
327 | "autoload": {
328 | "classmap": [
329 | "src/"
330 | ]
331 | },
332 | "notification-url": "https://packagist.org/downloads/",
333 | "license": [
334 | "BSD-3-Clause"
335 | ],
336 | "authors": [
337 | {
338 | "name": "Sebastian Bergmann",
339 | "email": "sb@sebastian-bergmann.de",
340 | "role": "lead"
341 | }
342 | ],
343 | "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.",
344 | "homepage": "https://github.com/sebastianbergmann/php-code-coverage",
345 | "keywords": [
346 | "coverage",
347 | "testing",
348 | "xunit"
349 | ],
350 | "time": "2015-10-06 15:47:00"
351 | },
352 | {
353 | "name": "phpunit/php-file-iterator",
354 | "version": "1.4.1",
355 | "source": {
356 | "type": "git",
357 | "url": "https://github.com/sebastianbergmann/php-file-iterator.git",
358 | "reference": "6150bf2c35d3fc379e50c7602b75caceaa39dbf0"
359 | },
360 | "dist": {
361 | "type": "zip",
362 | "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/6150bf2c35d3fc379e50c7602b75caceaa39dbf0",
363 | "reference": "6150bf2c35d3fc379e50c7602b75caceaa39dbf0",
364 | "shasum": ""
365 | },
366 | "require": {
367 | "php": ">=5.3.3"
368 | },
369 | "type": "library",
370 | "extra": {
371 | "branch-alias": {
372 | "dev-master": "1.4.x-dev"
373 | }
374 | },
375 | "autoload": {
376 | "classmap": [
377 | "src/"
378 | ]
379 | },
380 | "notification-url": "https://packagist.org/downloads/",
381 | "license": [
382 | "BSD-3-Clause"
383 | ],
384 | "authors": [
385 | {
386 | "name": "Sebastian Bergmann",
387 | "email": "sb@sebastian-bergmann.de",
388 | "role": "lead"
389 | }
390 | ],
391 | "description": "FilterIterator implementation that filters files based on a list of suffixes.",
392 | "homepage": "https://github.com/sebastianbergmann/php-file-iterator/",
393 | "keywords": [
394 | "filesystem",
395 | "iterator"
396 | ],
397 | "time": "2015-06-21 13:08:43"
398 | },
399 | {
400 | "name": "phpunit/php-text-template",
401 | "version": "1.2.1",
402 | "source": {
403 | "type": "git",
404 | "url": "https://github.com/sebastianbergmann/php-text-template.git",
405 | "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686"
406 | },
407 | "dist": {
408 | "type": "zip",
409 | "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686",
410 | "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686",
411 | "shasum": ""
412 | },
413 | "require": {
414 | "php": ">=5.3.3"
415 | },
416 | "type": "library",
417 | "autoload": {
418 | "classmap": [
419 | "src/"
420 | ]
421 | },
422 | "notification-url": "https://packagist.org/downloads/",
423 | "license": [
424 | "BSD-3-Clause"
425 | ],
426 | "authors": [
427 | {
428 | "name": "Sebastian Bergmann",
429 | "email": "sebastian@phpunit.de",
430 | "role": "lead"
431 | }
432 | ],
433 | "description": "Simple template engine.",
434 | "homepage": "https://github.com/sebastianbergmann/php-text-template/",
435 | "keywords": [
436 | "template"
437 | ],
438 | "time": "2015-06-21 13:50:34"
439 | },
440 | {
441 | "name": "phpunit/php-timer",
442 | "version": "1.0.7",
443 | "source": {
444 | "type": "git",
445 | "url": "https://github.com/sebastianbergmann/php-timer.git",
446 | "reference": "3e82f4e9fc92665fafd9157568e4dcb01d014e5b"
447 | },
448 | "dist": {
449 | "type": "zip",
450 | "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3e82f4e9fc92665fafd9157568e4dcb01d014e5b",
451 | "reference": "3e82f4e9fc92665fafd9157568e4dcb01d014e5b",
452 | "shasum": ""
453 | },
454 | "require": {
455 | "php": ">=5.3.3"
456 | },
457 | "type": "library",
458 | "autoload": {
459 | "classmap": [
460 | "src/"
461 | ]
462 | },
463 | "notification-url": "https://packagist.org/downloads/",
464 | "license": [
465 | "BSD-3-Clause"
466 | ],
467 | "authors": [
468 | {
469 | "name": "Sebastian Bergmann",
470 | "email": "sb@sebastian-bergmann.de",
471 | "role": "lead"
472 | }
473 | ],
474 | "description": "Utility class for timing",
475 | "homepage": "https://github.com/sebastianbergmann/php-timer/",
476 | "keywords": [
477 | "timer"
478 | ],
479 | "time": "2015-06-21 08:01:12"
480 | },
481 | {
482 | "name": "phpunit/php-token-stream",
483 | "version": "1.4.8",
484 | "source": {
485 | "type": "git",
486 | "url": "https://github.com/sebastianbergmann/php-token-stream.git",
487 | "reference": "3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da"
488 | },
489 | "dist": {
490 | "type": "zip",
491 | "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da",
492 | "reference": "3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da",
493 | "shasum": ""
494 | },
495 | "require": {
496 | "ext-tokenizer": "*",
497 | "php": ">=5.3.3"
498 | },
499 | "require-dev": {
500 | "phpunit/phpunit": "~4.2"
501 | },
502 | "type": "library",
503 | "extra": {
504 | "branch-alias": {
505 | "dev-master": "1.4-dev"
506 | }
507 | },
508 | "autoload": {
509 | "classmap": [
510 | "src/"
511 | ]
512 | },
513 | "notification-url": "https://packagist.org/downloads/",
514 | "license": [
515 | "BSD-3-Clause"
516 | ],
517 | "authors": [
518 | {
519 | "name": "Sebastian Bergmann",
520 | "email": "sebastian@phpunit.de"
521 | }
522 | ],
523 | "description": "Wrapper around PHP's tokenizer extension.",
524 | "homepage": "https://github.com/sebastianbergmann/php-token-stream/",
525 | "keywords": [
526 | "tokenizer"
527 | ],
528 | "time": "2015-09-15 10:49:45"
529 | },
530 | {
531 | "name": "phpunit/phpunit",
532 | "version": "4.8.21",
533 | "source": {
534 | "type": "git",
535 | "url": "https://github.com/sebastianbergmann/phpunit.git",
536 | "reference": "ea76b17bced0500a28098626b84eda12dbcf119c"
537 | },
538 | "dist": {
539 | "type": "zip",
540 | "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/ea76b17bced0500a28098626b84eda12dbcf119c",
541 | "reference": "ea76b17bced0500a28098626b84eda12dbcf119c",
542 | "shasum": ""
543 | },
544 | "require": {
545 | "ext-dom": "*",
546 | "ext-json": "*",
547 | "ext-pcre": "*",
548 | "ext-reflection": "*",
549 | "ext-spl": "*",
550 | "php": ">=5.3.3",
551 | "phpspec/prophecy": "^1.3.1",
552 | "phpunit/php-code-coverage": "~2.1",
553 | "phpunit/php-file-iterator": "~1.4",
554 | "phpunit/php-text-template": "~1.2",
555 | "phpunit/php-timer": ">=1.0.6",
556 | "phpunit/phpunit-mock-objects": "~2.3",
557 | "sebastian/comparator": "~1.1",
558 | "sebastian/diff": "~1.2",
559 | "sebastian/environment": "~1.3",
560 | "sebastian/exporter": "~1.2",
561 | "sebastian/global-state": "~1.0",
562 | "sebastian/version": "~1.0",
563 | "symfony/yaml": "~2.1|~3.0"
564 | },
565 | "suggest": {
566 | "phpunit/php-invoker": "~1.1"
567 | },
568 | "bin": [
569 | "phpunit"
570 | ],
571 | "type": "library",
572 | "extra": {
573 | "branch-alias": {
574 | "dev-master": "4.8.x-dev"
575 | }
576 | },
577 | "autoload": {
578 | "classmap": [
579 | "src/"
580 | ]
581 | },
582 | "notification-url": "https://packagist.org/downloads/",
583 | "license": [
584 | "BSD-3-Clause"
585 | ],
586 | "authors": [
587 | {
588 | "name": "Sebastian Bergmann",
589 | "email": "sebastian@phpunit.de",
590 | "role": "lead"
591 | }
592 | ],
593 | "description": "The PHP Unit Testing framework.",
594 | "homepage": "https://phpunit.de/",
595 | "keywords": [
596 | "phpunit",
597 | "testing",
598 | "xunit"
599 | ],
600 | "time": "2015-12-12 07:45:58"
601 | },
602 | {
603 | "name": "phpunit/phpunit-mock-objects",
604 | "version": "2.3.8",
605 | "source": {
606 | "type": "git",
607 | "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git",
608 | "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983"
609 | },
610 | "dist": {
611 | "type": "zip",
612 | "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/ac8e7a3db35738d56ee9a76e78a4e03d97628983",
613 | "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983",
614 | "shasum": ""
615 | },
616 | "require": {
617 | "doctrine/instantiator": "^1.0.2",
618 | "php": ">=5.3.3",
619 | "phpunit/php-text-template": "~1.2",
620 | "sebastian/exporter": "~1.2"
621 | },
622 | "require-dev": {
623 | "phpunit/phpunit": "~4.4"
624 | },
625 | "suggest": {
626 | "ext-soap": "*"
627 | },
628 | "type": "library",
629 | "extra": {
630 | "branch-alias": {
631 | "dev-master": "2.3.x-dev"
632 | }
633 | },
634 | "autoload": {
635 | "classmap": [
636 | "src/"
637 | ]
638 | },
639 | "notification-url": "https://packagist.org/downloads/",
640 | "license": [
641 | "BSD-3-Clause"
642 | ],
643 | "authors": [
644 | {
645 | "name": "Sebastian Bergmann",
646 | "email": "sb@sebastian-bergmann.de",
647 | "role": "lead"
648 | }
649 | ],
650 | "description": "Mock Object library for PHPUnit",
651 | "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/",
652 | "keywords": [
653 | "mock",
654 | "xunit"
655 | ],
656 | "time": "2015-10-02 06:51:40"
657 | },
658 | {
659 | "name": "sebastian/comparator",
660 | "version": "1.2.0",
661 | "source": {
662 | "type": "git",
663 | "url": "https://github.com/sebastianbergmann/comparator.git",
664 | "reference": "937efb279bd37a375bcadf584dec0726f84dbf22"
665 | },
666 | "dist": {
667 | "type": "zip",
668 | "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/937efb279bd37a375bcadf584dec0726f84dbf22",
669 | "reference": "937efb279bd37a375bcadf584dec0726f84dbf22",
670 | "shasum": ""
671 | },
672 | "require": {
673 | "php": ">=5.3.3",
674 | "sebastian/diff": "~1.2",
675 | "sebastian/exporter": "~1.2"
676 | },
677 | "require-dev": {
678 | "phpunit/phpunit": "~4.4"
679 | },
680 | "type": "library",
681 | "extra": {
682 | "branch-alias": {
683 | "dev-master": "1.2.x-dev"
684 | }
685 | },
686 | "autoload": {
687 | "classmap": [
688 | "src/"
689 | ]
690 | },
691 | "notification-url": "https://packagist.org/downloads/",
692 | "license": [
693 | "BSD-3-Clause"
694 | ],
695 | "authors": [
696 | {
697 | "name": "Jeff Welch",
698 | "email": "whatthejeff@gmail.com"
699 | },
700 | {
701 | "name": "Volker Dusch",
702 | "email": "github@wallbash.com"
703 | },
704 | {
705 | "name": "Bernhard Schussek",
706 | "email": "bschussek@2bepublished.at"
707 | },
708 | {
709 | "name": "Sebastian Bergmann",
710 | "email": "sebastian@phpunit.de"
711 | }
712 | ],
713 | "description": "Provides the functionality to compare PHP values for equality",
714 | "homepage": "http://www.github.com/sebastianbergmann/comparator",
715 | "keywords": [
716 | "comparator",
717 | "compare",
718 | "equality"
719 | ],
720 | "time": "2015-07-26 15:48:44"
721 | },
722 | {
723 | "name": "sebastian/diff",
724 | "version": "1.4.1",
725 | "source": {
726 | "type": "git",
727 | "url": "https://github.com/sebastianbergmann/diff.git",
728 | "reference": "13edfd8706462032c2f52b4b862974dd46b71c9e"
729 | },
730 | "dist": {
731 | "type": "zip",
732 | "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/13edfd8706462032c2f52b4b862974dd46b71c9e",
733 | "reference": "13edfd8706462032c2f52b4b862974dd46b71c9e",
734 | "shasum": ""
735 | },
736 | "require": {
737 | "php": ">=5.3.3"
738 | },
739 | "require-dev": {
740 | "phpunit/phpunit": "~4.8"
741 | },
742 | "type": "library",
743 | "extra": {
744 | "branch-alias": {
745 | "dev-master": "1.4-dev"
746 | }
747 | },
748 | "autoload": {
749 | "classmap": [
750 | "src/"
751 | ]
752 | },
753 | "notification-url": "https://packagist.org/downloads/",
754 | "license": [
755 | "BSD-3-Clause"
756 | ],
757 | "authors": [
758 | {
759 | "name": "Kore Nordmann",
760 | "email": "mail@kore-nordmann.de"
761 | },
762 | {
763 | "name": "Sebastian Bergmann",
764 | "email": "sebastian@phpunit.de"
765 | }
766 | ],
767 | "description": "Diff implementation",
768 | "homepage": "https://github.com/sebastianbergmann/diff",
769 | "keywords": [
770 | "diff"
771 | ],
772 | "time": "2015-12-08 07:14:41"
773 | },
774 | {
775 | "name": "sebastian/environment",
776 | "version": "1.3.3",
777 | "source": {
778 | "type": "git",
779 | "url": "https://github.com/sebastianbergmann/environment.git",
780 | "reference": "6e7133793a8e5a5714a551a8324337374be209df"
781 | },
782 | "dist": {
783 | "type": "zip",
784 | "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/6e7133793a8e5a5714a551a8324337374be209df",
785 | "reference": "6e7133793a8e5a5714a551a8324337374be209df",
786 | "shasum": ""
787 | },
788 | "require": {
789 | "php": ">=5.3.3"
790 | },
791 | "require-dev": {
792 | "phpunit/phpunit": "~4.4"
793 | },
794 | "type": "library",
795 | "extra": {
796 | "branch-alias": {
797 | "dev-master": "1.3.x-dev"
798 | }
799 | },
800 | "autoload": {
801 | "classmap": [
802 | "src/"
803 | ]
804 | },
805 | "notification-url": "https://packagist.org/downloads/",
806 | "license": [
807 | "BSD-3-Clause"
808 | ],
809 | "authors": [
810 | {
811 | "name": "Sebastian Bergmann",
812 | "email": "sebastian@phpunit.de"
813 | }
814 | ],
815 | "description": "Provides functionality to handle HHVM/PHP environments",
816 | "homepage": "http://www.github.com/sebastianbergmann/environment",
817 | "keywords": [
818 | "Xdebug",
819 | "environment",
820 | "hhvm"
821 | ],
822 | "time": "2015-12-02 08:37:27"
823 | },
824 | {
825 | "name": "sebastian/exporter",
826 | "version": "1.2.1",
827 | "source": {
828 | "type": "git",
829 | "url": "https://github.com/sebastianbergmann/exporter.git",
830 | "reference": "7ae5513327cb536431847bcc0c10edba2701064e"
831 | },
832 | "dist": {
833 | "type": "zip",
834 | "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/7ae5513327cb536431847bcc0c10edba2701064e",
835 | "reference": "7ae5513327cb536431847bcc0c10edba2701064e",
836 | "shasum": ""
837 | },
838 | "require": {
839 | "php": ">=5.3.3",
840 | "sebastian/recursion-context": "~1.0"
841 | },
842 | "require-dev": {
843 | "phpunit/phpunit": "~4.4"
844 | },
845 | "type": "library",
846 | "extra": {
847 | "branch-alias": {
848 | "dev-master": "1.2.x-dev"
849 | }
850 | },
851 | "autoload": {
852 | "classmap": [
853 | "src/"
854 | ]
855 | },
856 | "notification-url": "https://packagist.org/downloads/",
857 | "license": [
858 | "BSD-3-Clause"
859 | ],
860 | "authors": [
861 | {
862 | "name": "Jeff Welch",
863 | "email": "whatthejeff@gmail.com"
864 | },
865 | {
866 | "name": "Volker Dusch",
867 | "email": "github@wallbash.com"
868 | },
869 | {
870 | "name": "Bernhard Schussek",
871 | "email": "bschussek@2bepublished.at"
872 | },
873 | {
874 | "name": "Sebastian Bergmann",
875 | "email": "sebastian@phpunit.de"
876 | },
877 | {
878 | "name": "Adam Harvey",
879 | "email": "aharvey@php.net"
880 | }
881 | ],
882 | "description": "Provides the functionality to export PHP variables for visualization",
883 | "homepage": "http://www.github.com/sebastianbergmann/exporter",
884 | "keywords": [
885 | "export",
886 | "exporter"
887 | ],
888 | "time": "2015-06-21 07:55:53"
889 | },
890 | {
891 | "name": "sebastian/global-state",
892 | "version": "1.1.1",
893 | "source": {
894 | "type": "git",
895 | "url": "https://github.com/sebastianbergmann/global-state.git",
896 | "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4"
897 | },
898 | "dist": {
899 | "type": "zip",
900 | "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bc37d50fea7d017d3d340f230811c9f1d7280af4",
901 | "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4",
902 | "shasum": ""
903 | },
904 | "require": {
905 | "php": ">=5.3.3"
906 | },
907 | "require-dev": {
908 | "phpunit/phpunit": "~4.2"
909 | },
910 | "suggest": {
911 | "ext-uopz": "*"
912 | },
913 | "type": "library",
914 | "extra": {
915 | "branch-alias": {
916 | "dev-master": "1.0-dev"
917 | }
918 | },
919 | "autoload": {
920 | "classmap": [
921 | "src/"
922 | ]
923 | },
924 | "notification-url": "https://packagist.org/downloads/",
925 | "license": [
926 | "BSD-3-Clause"
927 | ],
928 | "authors": [
929 | {
930 | "name": "Sebastian Bergmann",
931 | "email": "sebastian@phpunit.de"
932 | }
933 | ],
934 | "description": "Snapshotting of global state",
935 | "homepage": "http://www.github.com/sebastianbergmann/global-state",
936 | "keywords": [
937 | "global state"
938 | ],
939 | "time": "2015-10-12 03:26:01"
940 | },
941 | {
942 | "name": "sebastian/recursion-context",
943 | "version": "1.0.2",
944 | "source": {
945 | "type": "git",
946 | "url": "https://github.com/sebastianbergmann/recursion-context.git",
947 | "reference": "913401df809e99e4f47b27cdd781f4a258d58791"
948 | },
949 | "dist": {
950 | "type": "zip",
951 | "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/913401df809e99e4f47b27cdd781f4a258d58791",
952 | "reference": "913401df809e99e4f47b27cdd781f4a258d58791",
953 | "shasum": ""
954 | },
955 | "require": {
956 | "php": ">=5.3.3"
957 | },
958 | "require-dev": {
959 | "phpunit/phpunit": "~4.4"
960 | },
961 | "type": "library",
962 | "extra": {
963 | "branch-alias": {
964 | "dev-master": "1.0.x-dev"
965 | }
966 | },
967 | "autoload": {
968 | "classmap": [
969 | "src/"
970 | ]
971 | },
972 | "notification-url": "https://packagist.org/downloads/",
973 | "license": [
974 | "BSD-3-Clause"
975 | ],
976 | "authors": [
977 | {
978 | "name": "Jeff Welch",
979 | "email": "whatthejeff@gmail.com"
980 | },
981 | {
982 | "name": "Sebastian Bergmann",
983 | "email": "sebastian@phpunit.de"
984 | },
985 | {
986 | "name": "Adam Harvey",
987 | "email": "aharvey@php.net"
988 | }
989 | ],
990 | "description": "Provides functionality to recursively process PHP variables",
991 | "homepage": "http://www.github.com/sebastianbergmann/recursion-context",
992 | "time": "2015-11-11 19:50:13"
993 | },
994 | {
995 | "name": "sebastian/version",
996 | "version": "1.0.6",
997 | "source": {
998 | "type": "git",
999 | "url": "https://github.com/sebastianbergmann/version.git",
1000 | "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6"
1001 | },
1002 | "dist": {
1003 | "type": "zip",
1004 | "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/58b3a85e7999757d6ad81c787a1fbf5ff6c628c6",
1005 | "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6",
1006 | "shasum": ""
1007 | },
1008 | "type": "library",
1009 | "autoload": {
1010 | "classmap": [
1011 | "src/"
1012 | ]
1013 | },
1014 | "notification-url": "https://packagist.org/downloads/",
1015 | "license": [
1016 | "BSD-3-Clause"
1017 | ],
1018 | "authors": [
1019 | {
1020 | "name": "Sebastian Bergmann",
1021 | "email": "sebastian@phpunit.de",
1022 | "role": "lead"
1023 | }
1024 | ],
1025 | "description": "Library that helps with managing the version number of Git-hosted PHP projects",
1026 | "homepage": "https://github.com/sebastianbergmann/version",
1027 | "time": "2015-06-21 13:59:46"
1028 | },
1029 | {
1030 | "name": "symfony/yaml",
1031 | "version": "v2.8.2",
1032 | "source": {
1033 | "type": "git",
1034 | "url": "https://github.com/symfony/yaml.git",
1035 | "reference": "34c8a4b51e751e7ea869b8262f883d008a2b81b8"
1036 | },
1037 | "dist": {
1038 | "type": "zip",
1039 | "url": "https://api.github.com/repos/symfony/yaml/zipball/34c8a4b51e751e7ea869b8262f883d008a2b81b8",
1040 | "reference": "34c8a4b51e751e7ea869b8262f883d008a2b81b8",
1041 | "shasum": ""
1042 | },
1043 | "require": {
1044 | "php": ">=5.3.9"
1045 | },
1046 | "type": "library",
1047 | "extra": {
1048 | "branch-alias": {
1049 | "dev-master": "2.8-dev"
1050 | }
1051 | },
1052 | "autoload": {
1053 | "psr-4": {
1054 | "Symfony\\Component\\Yaml\\": ""
1055 | },
1056 | "exclude-from-classmap": [
1057 | "/Tests/"
1058 | ]
1059 | },
1060 | "notification-url": "https://packagist.org/downloads/",
1061 | "license": [
1062 | "MIT"
1063 | ],
1064 | "authors": [
1065 | {
1066 | "name": "Fabien Potencier",
1067 | "email": "fabien@symfony.com"
1068 | },
1069 | {
1070 | "name": "Symfony Community",
1071 | "homepage": "https://symfony.com/contributors"
1072 | }
1073 | ],
1074 | "description": "Symfony Yaml Component",
1075 | "homepage": "https://symfony.com",
1076 | "time": "2016-01-13 10:28:07"
1077 | }
1078 | ],
1079 | "aliases": [],
1080 | "minimum-stability": "stable",
1081 | "stability-flags": [],
1082 | "prefer-stable": true,
1083 | "prefer-lowest": false,
1084 | "platform": [],
1085 | "platform-dev": [],
1086 | "platform-overrides": {
1087 | "php": "5.4"
1088 | }
1089 | }
1090 |
--------------------------------------------------------------------------------