-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
ingoldsby
committed
Jun 9, 2020
0 parents
commit 0184413
Showing
16 changed files
with
590 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Path-based git attributes | ||
# https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html | ||
|
||
# Ignore all test and documentation with "export-ignore". | ||
/.gitattributes export-ignore | ||
/.gitignore export-ignore | ||
/.travis.yml export-ignore | ||
/phpunit.xml.dist export-ignore | ||
/tests export-ignore | ||
/.editorconfig export-ignore | ||
/.php.cs export-ignore | ||
/.github export-ignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: Run tests | ||
|
||
on: | ||
push: | ||
pull_request: | ||
schedule: | ||
- cron: '0 0 * * *' | ||
|
||
jobs: | ||
php-tests: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
php: [7.4] | ||
|
||
name: PHP${{ matrix.php }} - ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v1 | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v1 | ||
with: | ||
php-version: ${{ matrix.php }} | ||
coverage: none | ||
|
||
- name: Install dependencies | ||
run: | | ||
sudo composer self-update | ||
composer update --prefer-stable --prefer-dist --no-interaction --no-suggest | ||
- name: Execute tests | ||
run: vendor/bin/phpunit --testdox | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
build | ||
composer.lock | ||
docs | ||
vendor | ||
coverage | ||
.phpunit.result.cache | ||
.idea | ||
.php_cs.cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Changelog | ||
|
||
All notable changes to `laravel-dashboard-shopify-tile` will be documented in this file | ||
|
||
## 1.0.0 - 2020-06-09 | ||
|
||
- initial release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# Contributing | ||
|
||
Contributions are **welcome** and will be fully **credited**. | ||
|
||
Please read and understand the contribution guide before creating an issue or pull request. | ||
|
||
## Etiquette | ||
|
||
This project is open source, and as such, the maintainers give their free time to build and maintain the source code | ||
held within. They make the code freely available in the hope that it will be of use to other developers. It would be | ||
extremely unfair for them to suffer abuse or anger for their hard work. | ||
|
||
Please be considerate towards maintainers when raising issues or presenting pull requests. Let's show the | ||
world that developers are civilized and selfless people. | ||
|
||
It's the duty of the maintainer to ensure that all submissions to the project are of sufficient | ||
quality to benefit the project. Many developers have different skillsets, strengths, and weaknesses. Respect the maintainer's decision, and do not be upset or abusive if your submission is not used. | ||
|
||
## Viability | ||
|
||
When requesting or submitting new features, first consider whether it might be useful to others. Open | ||
source projects are used by many developers, who may have entirely different needs to your own. Think about | ||
whether or not your feature is likely to be used by other users of the project. | ||
|
||
## Procedure | ||
|
||
Before filing an issue: | ||
|
||
- Attempt to replicate the problem, to ensure that it wasn't a coincidental incident. | ||
- Check to make sure your feature suggestion isn't already present within the project. | ||
- Check the pull requests tab to ensure that the bug doesn't have a fix in progress. | ||
- Check the pull requests tab to ensure that the feature isn't already in progress. | ||
|
||
Before submitting a pull request: | ||
|
||
- Check the codebase to ensure that your feature doesn't already exist. | ||
- Check the pull requests to ensure that another person hasn't already submitted the feature or fix. | ||
|
||
## Requirements | ||
|
||
If the project maintainer has any additional requirements, you will find them listed here. | ||
|
||
- **[PSR-2 Coding Standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)** - The easiest way to apply the conventions is to install [PHP Code Sniffer](https://pear.php.net/package/PHP_CodeSniffer). | ||
|
||
- **Add tests!** - Your patch won't be accepted if it doesn't have tests. | ||
|
||
- **Document any change in behaviour** - Make sure the `README.md` and any other relevant documentation are kept up-to-date. | ||
|
||
- **Consider our release cycle** - We try to follow [SemVer v2.0.0](https://semver.org/). Randomly breaking public APIs is not an option. | ||
|
||
- **One pull request per feature** - If you want to do more than one thing, send multiple pull requests. | ||
|
||
- **Send coherent history** - Make sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please [squash them](https://www.git-scm.com/book/en/v2/Git-Tools-Rewriting-History#Changing-Multiple-Commit-Messages) before submitting. | ||
|
||
**Happy coding**! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) :vendor_name | ||
|
||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
# A tile to display Shopify information | ||
|
||
[![Latest Version on Packagist](https://img.shields.io/packagist/v/ingoldsby/laravel-dashboard-shopify-tile.svg?style=flat-square)](https://packagist.org/packages/ingoldsby/laravel-dashboard-shopify-tile) | ||
[![Total Downloads](https://img.shields.io/packagist/dt/ingoldsby/laravel-dashboard-shopify-tile.svg?style=flat-square)](https://packagist.org/packages/ingoldsby/laravel-dashboard-shopify-tile) | ||
|
||
This tile can be used on [the Laravel Dashboard](https://docs.spatie.be/laravel-dashboard) to display Shopify information. | ||
|
||
## Installation | ||
|
||
You can install the package via composer: | ||
|
||
```bash | ||
composer require ingoldsby/laravel-dashboard-shopify-tile | ||
``` | ||
|
||
## Shopify API credentials | ||
|
||
Before using this tile you need to have created a [private app](https://help.shopify.com/en/manual/apps/private-apps) on the Shopify admin page and obtained an API key and password. | ||
|
||
## Usage | ||
|
||
In the `dashboard` config file, you must add this configuration in the `tiles` key. | ||
|
||
```php | ||
// in config/dashboard.php | ||
|
||
return [ | ||
// ... | ||
'tiles' => [ | ||
'shopify' => [ | ||
'api_key' => env('SHOPIFY_API_KEY'), | ||
'password' => env('SHOPIFY_API_PASSWORD'), | ||
] | ||
], | ||
]; | ||
``` | ||
|
||
In `app\Console\Kernel.php` you should schedule the `\Ingoldsby\ShopifyTile\Commands\FetchShopifyInfoCommand` to run. You can let it run every minute if you want. You could also run this less frequently if fast updates on the dashboard aren’t that important for this tile. | ||
|
||
```php | ||
// in app/console/Kernel.php | ||
|
||
protected function schedule(Schedule $schedule) | ||
{ | ||
// ... | ||
$schedule->command(\Ingoldsby\ShopifyTile\Commands\FetchShopifyInfoCommand::class)->everyMinute(); | ||
} | ||
``` | ||
|
||
In your dashboard view you can use three separate tiles: | ||
* `livewire:shopify-tile` | ||
|
||
```html | ||
<x-dashboard> | ||
<livewire:shopify-tile position="a1:a4" /> | ||
</x-dashboard> | ||
``` | ||
|
||
## Testing | ||
|
||
``` bash | ||
composer test | ||
``` | ||
|
||
## Changelog | ||
|
||
Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently. | ||
|
||
## Contributing | ||
|
||
Please see [CONTRIBUTING](CONTRIBUTING.md) for details. | ||
|
||
## Security | ||
|
||
If you discover any security related issues, please email instead of using the issue tracker. | ||
|
||
## Support Spatie | ||
|
||
I have learnt a lot from Spatie's various packages, including [Mailcoach](https://mailcoach.app), and would recommend you check them out if you want to know more. | ||
|
||
Learn how to create a package like this one, by watching Spatie's premium video course: | ||
|
||
[![Laravel Package training](https://spatie.be/github/package-training.jpg)](https://laravelpackage.training) | ||
|
||
Spatie invest a lot of resources into creating [best in class open source packages](https://spatie.be/open-source). You can support them by [buying one of their paid products](https://spatie.be/open-source/support-us). | ||
|
||
## Credits | ||
|
||
- [Ingoldsby](https://github.com/ingoldsby) | ||
- [All Contributors](../../contributors) | ||
|
||
## License | ||
|
||
The MIT License (MIT). Please see [License File](LICENSE.md) for more information. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
{ | ||
"name": "ingoldsby/laravel-dashboard-shopify-tile", | ||
"description": "A Shopify tile for Laravel Dashboard", | ||
"keywords": [ | ||
"ingoldsby", | ||
"laravel-dashboard-shopify-tile" | ||
], | ||
"homepage": "https://github.com/ingoldsby/laravel-dashboard-shopify-tile", | ||
"license": "MIT", | ||
"authors": [ | ||
{ | ||
"name": "Ingoldsby", | ||
"email": "[email protected]", | ||
"role": "Developer" | ||
} | ||
], | ||
"require": { | ||
"php": "^7.4", | ||
"spatie/laravel-dashboard": "^1.0" | ||
}, | ||
"require-dev": { | ||
"phpunit/phpunit": "^9.0" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"Ingoldsby\\ShopifyTile\\": "src" | ||
} | ||
}, | ||
"autoload-dev": { | ||
"psr-4": { | ||
"Spatie\\ShopifyTile\\Tests\\": "tests" | ||
} | ||
}, | ||
"scripts": { | ||
"test": "vendor/bin/phpunit", | ||
"test-coverage": "vendor/bin/phpunit --coverage-html coverage", | ||
"format": "vendor/bin/php-cs-fixer fix --allow-risky=yes" | ||
}, | ||
"config": { | ||
"sort-packages": true | ||
}, | ||
"extra": { | ||
"laravel": { | ||
"providers": [ | ||
"Ingoldsby\\ShopifyTile\\ShopifyServiceProvider" | ||
] | ||
} | ||
}, | ||
"minimum-stability": "dev", | ||
"prefer-stable": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<phpunit bootstrap="vendor/autoload.php" | ||
backupGlobals="false" | ||
backupStaticAttributes="false" | ||
colors="true" | ||
verbose="true" | ||
convertErrorsToExceptions="true" | ||
convertNoticesToExceptions="true" | ||
convertWarningsToExceptions="true" | ||
processIsolation="false" | ||
stopOnFailure="false" | ||
> | ||
<testsuites> | ||
<testsuite name="Tests"> | ||
<directory>tests</directory> | ||
</testsuite> | ||
</testsuites> | ||
<filter> | ||
<whitelist> | ||
<directory suffix=".php">src/</directory> | ||
</whitelist> | ||
</filter> | ||
<logging> | ||
<log type="junit" target="build/report.junit.xml"/> | ||
<log type="coverage-html" target="build/coverage"/> | ||
<log type="coverage-text" target="build/coverage.txt"/> | ||
<log type="coverage-clover" target="build/logs/clover.xml"/> | ||
</logging> | ||
</phpunit> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
<x-dashboard-tile :position="$position" :fade="false"> | ||
<div wire:poll.{{ $refreshIntervalInSeconds }}s> | ||
<div class="flex flex-wrap -mx-1 overflow-hidden"> | ||
<div class="my-1 px-1 w-full overflow-hidden sm:w-full md:w-1/2 lg:w-1/2 xl:w-1/2"> | ||
<div class="grid gap-4 justify-items-center h-full text-center"> | ||
<div class="font-medium text-dimmed text-sm tracking-wide uppercase tabular-nums"> | ||
CUSTOMERS | ||
</div> | ||
<div class="self-center font-bold text-4xl tracking-wide leading-none"> | ||
{{ $shopify['customers']['count'] }} | ||
</div> | ||
<div class="text-dimmed text-xs"> | ||
@isset ($shopify['customers']['latest']['first_name']) | ||
{{ ucfirst($shopify['customers']['latest']['first_name']) }} | ||
@else | ||
Last | ||
@endif | ||
registered {{ \Carbon\Carbon::parse($shopify['customers']['latest']['created_at'])->diffForHumans() }} | ||
</div> | ||
</div> | ||
</div> | ||
<div class="my-1 px-1 w-full overflow-hidden sm:w-full md:w-1/2 lg:w-1/2 xl:w-1/2"> | ||
<div class="grid gap-4 justify-items-center h-full text-center"> | ||
<div class="font-medium text-dimmed text-sm tracking-wide uppercase tabular-nums"> | ||
ORDERS | ||
</div> | ||
<div class="self-center font-bold text-4xl tracking-wide leading-none"> | ||
{{ $shopify['orders']['count'] }} | ||
</div> | ||
<div class="text-dimmed text-xs"> | ||
{{ $shopify['orders']['latest']['name'] }} created {{ \Carbon\Carbon::parse($shopify['orders']['latest']['created_at'])->diffForHumans() }} | ||
</div> | ||
</div> | ||
</div> | ||
<div class="my-1 pt-4 px-1 w-full overflow-hidden sm:w-full md:w-1/2 lg:w-1/2 xl:w-1/2"> | ||
<div class="grid gap-4 justify-items-center h-full text-center"> | ||
<div class="font-medium text-dimmed text-sm tracking-wide uppercase tabular-nums"> | ||
ABANDONED CARTS | ||
</div> | ||
<div class="self-center font-bold text-4xl tracking-wide leading-none"> | ||
{{ $shopify['checkouts']['count'] }} | ||
</div> | ||
@isset ($shopify['checkouts']['latest']['created_at']) | ||
<div class="text-dimmed text-xs"> | ||
Last abandoned {{ \Carbon\Carbon::parse($shopify['checkouts']['latest']['created_at'])->diffForHumans() }} | ||
</div> | ||
@else | ||
<div class="text-dimmed text-xs"> | ||
No active abandoned carts | ||
</div> | ||
@endisset | ||
</div> | ||
</div> | ||
<div class="my-1 pt-4 px-1 w-full overflow-hidden sm:w-full md:w-1/2 lg:w-1/2 xl:w-1/2"> | ||
<div class="grid gap-4 justify-items-center h-full text-center"> | ||
<div class="font-medium text-dimmed text-sm tracking-wide uppercase tabular-nums"> | ||
PRODUCTS | ||
</div> | ||
<div class="self-center font-bold text-4xl tracking-wide leading-none"> | ||
{{ $shopify['products']['count'] }} | ||
</div> | ||
<div class="text-dimmed text-xs"> | ||
{{ $shopify['products']['latest']['title'] }} created {{ \Carbon\Carbon::parse($shopify['orders']['latest']['created_at'])->diffForHumans() }} | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</x-dashboard-tile> |
Oops, something went wrong.