digikraaft/laravel-dashboard-stripe-customers-tile

A tile to show list of Stripe Customers on Laravel Dashboard

v2.0 2020-09-10 05:23 UTC

This package is auto-updated.

Last update: 2024-04-10 14:06:20 UTC


README

run-tests Build Status Scrutinizer Code Quality Code Intelligence Status License: MIT

This tile displays the list of Stripe customers. It can be used on the Laravel Dashboard.

Installation

You can install the package via composer:

composer require digikraaft/laravel-dashboard-stripe-customers-tile

You need to publish the migrations and config file of the Laravel Dashboard package. In the dashboard config file, you can optionally add this configuration in the tiles key and customize it for your own needs:

// in config/dashboard.php

'tiles' => [

        /**
         * Stripe configuration settings
         */
        'stripe' => [

            'secret_key' => env('STRIPE_SECRET'),

            'customers' => [

                /**
                 * the values here must be supported by the Stripe API
                 * @link https://stripe.com/docs/api/customers/list?lang=php
                 */
                'params' => [
                    'limit' => 5,
                ],

                /**
                 * How often should the data be refreshed in seconds
                 */
                'refresh_interval_in_seconds' => 1800,
            ],
        ],
    ],

You must set your STRIPE_SECRET in the .env file. You can get this from your Stripe dashboard. To load the customer data from Stripe at regular intervals, you need to schedule the FetchCustomersDataFromStripeApi command:

// in app/Console/Kernel.php
use Digikraaft\StripeCustomersTile\FetchCustomersDataFromStripeApi;

protected function schedule(Schedule $schedule)
{
    $schedule->command(FetchCustomersDataFromStripeApi::class)->twiceDaily();
}

You can change the frequency of the schedule as desired. You can also use the php artisan dashboard:fetch-customers-data-from-stripe-api command.

Usage

In your dashboard view you use the livewire:stripe-customers-tile component.

<x-dashboard>
    <livewire:stripe-customers-tile position="e7:e16" />
</x-dashboard>

You can add an optional title:

<x-dashboard>
    <livewire:stripe-customers-tile position="e7:e16" title="Stripe Customers" />
</x-dashboard>

Pagination

The package paginates data by default. The default value is 5. This can be changed by adding a perPage property to the tile:

<x-dashboard>
    <livewire:stripe-customers-tile position="e7:e16" title="Stripe Customers" perPage="10" />
</x-dashboard>

Testing

Use the command below to run your tests:

composer test

More Good Stuff

Check here for more awesome free stuff!

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email dev@digitalkraaft.com instead of using the issue tracker.

Credits

Thanks to

License

The MIT License (MIT). Please see License File for more information.