schulzefelix / laravel-stat-search-analytics
A Laravel API Wrapper For STAT Search Analytics.
Requires
- php: ^7.2.5
- guzzlehttp/guzzle: ^6.3
- laravel/framework: ^7.0
- nesbot/carbon: ^2.0
- schulzefelix/laravel-data-transfer-object: ^1.3.0
Requires (Dev)
- mockery/mockery: ^1.3
- orchestra/testbench: ^4.0|^5.0
- phpunit/phpunit: ^8.0|^9.0
README
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.