Skip to content

Commit

Permalink
Initial release (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
glorand authored Dec 27, 2018
1 parent 3e76580 commit 2d5be06
Show file tree
Hide file tree
Showing 20 changed files with 406 additions and 3 deletions.
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Bug report
about: Create a report to help us improve
title: "[BUG]"
labels: bug
assignees: glorand

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:

**Expected behavior**
A clear and concise description of what you expected to happen.

**Additional context**
Add any other context about the problem here.
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: enhancement
assignees: glorand

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
composer.phar
vendor/
/.idea
.php_cs.cache
composer.lock

# Commit your application's lock file http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file
# You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file
# composer.lock
38 changes: 38 additions & 0 deletions .scrutinizer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
build:
nodes:
analysis:
tests:
override:
- php-scrutinizer-run
- command: phpcs-run
use_website_config: true
- command: './vendor/bin/phpunit --coverage-clover=coverage.xml'
coverage:
file: coverage.xml
format: clover
filter:
excluded_paths:
- 'tests/*'
checks:
php:
remove_extra_empty_lines: true
remove_php_closing_tag: true
remove_trailing_whitespace: true
fix_use_statements:
remove_unused: true
preserve_multiple: false
preserve_blanklines: true
order_alphabetically: true
fix_php_opening_tag: true
fix_linefeed: true
fix_line_ending: true
fix_identation_4spaces: true
fix_doc_comments: true

coding_style:
php:
spaces:
around_operators:
concatenation: true
other:
after_type_cast: false
3 changes: 3 additions & 0 deletions .styleci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
preset: psr2
enabled:
- phpdoc_annotation_without_dot
12 changes: 12 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
language: php

php:
- 7.1
- 7.2

before_script:
- composer selfupdate
- composer install

script:
- vendor/bin/phpunit --coverage-clover=coverage.xml
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Changelog

All notable changes to `glorand/laravel-drip` will be documented in this file

## 1.0.0 - 2018-12-27
### Added
- Initial release
49 changes: 49 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Contribution Guide

This project adheres to the following standards and practices.

## Versioning

This package is versioned under the [Semantic Versioning](http://semver.org/) guidelines as much as possible.

Releases will be numbered with the following format:

`<major>.<minor>.<patch>`

And constructed with the following guidelines:

* Breaking backward compatibility bumps the major and resets the minor and patch.
* New additions without breaking backward compatibility bumps the minor and resets the patch.
* Bug fixes and misc changes bumps the patch.

## Coding Standards

This package is compliant with the
[PSR-1](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-1-basic-coding-standard.md),
[PSR-2](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md) and
[PSR-4](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-4-autoloader.md).
If you notice any compliance oversights, please send a patch via pull request.

## Pull Requests

The pull request process differs for new features and bugs.

Pull requests for bugs may be sent without creating any proposal issue.
If you believe that you know of a solution for a bug that has been filed,
please leave a comment detailing your proposed fix or create a pull request with the fix mentioning that issue id.

### Proposal \ Feature Requests

If you have a proposal or a feature request, you may create an issue with `[Proposal]` in the title.

The proposal should also describe the new feature, as well as implementation ideas.
The proposal will then be reviewed and either approved or denied. Once a proposal is approved,
a pull request may be created implementing the new feature.

### Which Branch?

**ALL** bug fixes should be made to the branch which they belong to.
Bug fixes should never be sent to the `master` branch unless they fix features that exist only in the upcoming release.

If a bug is found on a `minor` version `1.1` and it exists on the `major` version `1.0`,
the bug fix should be sent to the `1.0` branch which will be afterwards merged into the `1.1` branch.
19 changes: 19 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Copyright (c) Gombos Lorand

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
<p align="center">
<img src="https://user-images.githubusercontent.com/883989/49755957-17ec0980-fcc2-11e8-9e04-0339714f979b.png">
<img height="90px" alt="drip" src="https://user-images.githubusercontent.com/883989/50478538-685da980-09da-11e9-92b3-6b2351dfd60e.png">
</p>

<p align="center">
<img height="90px" alt="laravel" src="https://user-images.githubusercontent.com/883989/50478539-685da980-09da-11e9-8251-18003e023ac9.png">
</p>

<h6 align="center">
Expand Down Expand Up @@ -55,10 +59,10 @@ For usage, please refer to the Drip PHP package documentation, located [here](ht
Use **``namespace Glorand\Drip\Laravel\DripContract``** in your controller or service constructor

### Facade
Just use the Laravel facade alias **``Drip::``** instead of the native call **``$drip->``**.
Just use the Laravel facade alias **``Drip::``** instead of the native call [**``$drip->``**](https://github.com/glorand/drip).

### Helper
Just use the helper function **``drip()``** instead of the native call **``$drip->``**.
Just use the helper function **``drip()``** instead of the native call [**``$drip->``**](https://github.com/glorand/drip).

## Changelog <a name="changelog"></a>
Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.
Expand Down
54 changes: 54 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"name": "glorand/laravel-drip",
"description": "A Laravel wrapper for Drip's REST API v2.0",
"license": "MIT",
"authors": [
{
"name": "Lorand Gombos",
"email": "gombos.lorand@gmail.com"
}
],
"type": "laravel-package",
"keywords": [
"glorand",
"laravel-drip",
"drip",
"drip-php",
"drip-api"
],
"require": {
"php": ">=7.1.3",
"illuminate/support": "5.6.*|5.7.*",
"glorand/drip-php": "^1.0"
},
"require-dev": {
"phpunit/phpunit": "^7.0"
},
"autoload": {
"psr-4": {
"Glorand\\Drip\\Laravel\\": "src/"
},
"files": [
"src/helpers.php"
]
},
"autoload-dev": {
"psr-4": {
"Glorand\\Drip\\Laravel\\Tests\\": "tests"
}
},
"extra": {
"laravel": {
"providers": [
"Glorand\\Drip\\Laravel\\DripServiceProvider"
],
"aliases": {
"Drip": "Glorand\\Drip\\Laravel\\Facades\\Drip"
}
}
},
"minimum-stability": "dev",
"scripts": {
"stan": "vendor/bin/phpstan analyse src --level=7"
}
}
7 changes: 7 additions & 0 deletions config/laravel_drip.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php
return [
'drip_account_id' => env('DRIP_ACCOUNT_ID'),
'drip_api_key' => env('DRIP_API_KEY'),
'drip_user_agent' => env('DRIP_USER_AGENT'),
'enabled' => env('DRIP_ENABLED', false),
];
28 changes: 28 additions & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
>
<testsuites>
<testsuite name="Laravel Drip Test Suite">
<directory suffix="Test.php">./tests/</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory suffix=".php">./src/</directory>
</whitelist>
</filter>
<logging>
<log type="coverage-text" target="php://stdout" showUncoveredFiles="true"/>
</logging>
<php>

</php>
</phpunit>
25 changes: 25 additions & 0 deletions src/DripContract.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

namespace Glorand\Drip\Laravel;

use Glorand\Drip\Api\Accounts;
use Glorand\Drip\Api\Events;
use Glorand\Drip\Api\Subscribers;

interface DripContract
{
/**
* @return \Glorand\Drip\Api\Events
*/
public function events(): Events;

/**
* @return \Glorand\Drip\Api\Subscribers
*/
public function subscribers(): Subscribers;

/**
* @return \Glorand\Drip\Api\Accounts
*/
public function accounts(): Accounts;
}
16 changes: 16 additions & 0 deletions src/DripFacade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

namespace Glorand\Drip\Laravel;

use Illuminate\Support\Facades\Facade;

class DripFacade extends Facade
{
/**
* {@inheritDoc}
*/
protected static function getFacadeAccessor()
{
return 'drip';
}
}
39 changes: 39 additions & 0 deletions src/DripServiceProvider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php

namespace Glorand\Drip\Laravel;

use Illuminate\Support\ServiceProvider;

class DripServiceProvider extends ServiceProvider
{
protected $defer = true;

public function register()
{
$this->app->bind('drip', function ($app) {
return new LaravelDrip(
config('laravel_drip.drip_account_id'),
config('laravel_drip.drip_api_key'),
config('laravel_drip.drip_user_agent')
);
});
$this->app->alias('drip', \Glorand\Drip\Laravel\DripContract::class);
}

public function boot()
{
$this->publishes([
__DIR__ . '/../config/laravel_drip.php' => config_path('laravel_drip.php'),
]);

$this->mergeConfigFrom(__DIR__.'/../config/laravel_drip.php', 'laravel_drip');
}

public function provides()
{
return [
\Glorand\Drip\Laravel\DripContract::class,
'drip'
];
}
}
Loading

0 comments on commit 2d5be06

Please sign in to comment.