schulzefelix/laravel-stat-search-analytics

A Laravel API Wrapper For STAT Search Analytics.

1.6.0 2020-04-12 19:49 UTC

This package is auto-updated.

Last update: 2024-12-13 06:28:53 UTC


README

Latest Version Software License Build Status Quality Score StyleCI Latest Version on Packagist Total Downloads

For information about STAT Search Analytics see https://getstat.com/

Install

This package can be installed through Composer.

$ composer require schulzefelix/laravel-stat-search-analytics

In Laravel 5.5 the package will autoregister the service provider. In Laravel 5.4 you must install this service provider.

// config/app.php
'providers' => [
    ...
    SchulzeFelix\Stat\StatServiceProvider::class,
    ...
];

In Laravel 5.5 the package will autoregister the facade. In Laravel 5.4 you must install the facade manually.

// config/app.php
'aliases' => [
    ...
    'Stat' => SchulzeFelix\Stat\StatFacade::class,
    ...
];

You can publish the config file of this package with this command:

php artisan vendor:publish --provider="SchulzeFelix\Stat\StatServiceProvider"

Usage

Introduction

The responses of this packages are combinations of Laravel Collections, objects for each kind of data object and Carbon instances for date fields.

Projects Methods

List All Projects

The list methods returns a collection of all projects.

$projects = Stat::projects()->list();

Create A Project

To create a project just pass the name of the project. The response will we a StatProject instance.

$project = Stat::projects()->create('Cheese Cake Factory');

$project->toArray();

/*
[
    'id' => 615,
    'name' => 'Cheese Cake Factory',
    'total_sites' => 0,
    'created_at' => 2016-11-01,
    'updated_at' => 2016-11-01,
]
*/

Update A Project

To update the name of a project just pass the project ID and the new name. The response will we a StatProject instance.

$project = Stat::projects()->update(615, 'Cheese Cake Bakery');

$project->toArray();

/*
[
    'id' => 615,
    'name' => 'Cheese Cake Bakery',
    'total_sites' => 5,
    'created_at' => 2016-11-01,
    'updated_at' => 2016-11-03,
]
*/

Delete A Project

To delete a project just pass the project ID. The response the project ID.

$project = Stat::projects()->delete(615);

Change log

Please see CHANGELOG for more information what has changed recently.

Testing

$ vendor/bin/phpunit

Contributing

Please see CONTRIBUTING and CONDUCT for details.

Credits

License

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