laravel plausible
1.2.0
Laravel 내에서 그럴듯한 API와 통신하기위한 간단한 패키지.
작곡가를 통해 패키지를 설치할 수 있습니다.
composer require kilobyteno/laravel-plausible구성 파일을 다음과 같이 게시 할 수 있습니다.
php artisan vendor:publish --tag= " plausible-config "이것은 게시 된 구성 파일의 내용입니다.
return [
' api_url ' => env ( ' PLAUSIBLE_API_URL ' , ' https://plausible.io/api/v1 ' ),
' api_key ' => env ( ' PLAUSIBLE_API_KEY ' , '' ),
]; use Kilobyteno LaravelPlausible Plausible ;
// Show the stats for the default period (30d), the period is optional for all methods
$ visitors = Plausible:: getVisitors ( $ domain -> name );
// Show the stats for the last 12 months
$ pageviews = Plausible:: getPageviews ( $ domain -> name , ' 12mo ' );
// Get bounce rates for the last 7 days
$ bounceRate = Plausible:: getBounceRate ( $ domain -> name , ' 7d ' );
// Get visit duration for the last days
$ visitDuration = Plausible:: getVisitDuration ( $ domain -> name , ' day ' );
// Get realtime visitors
$ realtimeVisitors = Plausible:: getRealtimeVisitors ( $ domain -> name );
// Add a custom period and metrics
$ stats = Plausible:: get ( $ domain -> name , ' month ' , [ ' visitors ' , ' pageviews ' ]);
$ availablePeriods = Plausible:: getAllowedPeriods ();
// returns: ['12mo', '6mo', 'month', '30d', '7d', 'day']
$ allowedMetrics = Plausible:: getAllowedMetrics ();
// returns: ['visitors', 'pageviews', 'bounce_rate', 'visit_duration', 'visits', 'events']
$ allowedProperties = Plausible:: getAllowedProperties ();
/*
returns [
'event:name',
'event:page',
'visit:entry_page',
'visit:exit_page',
'visit:source',
'visit:referrer',
'visit:utm_medium',
'visit:utm_source',
'visit:utm_campaign',
'visit:utm_content',
'visit:utm_term',
'visit:device',
'visit:browser',
'visit:browser_version',
'visit:os',
'visit:os_version',
'visit:country',
];
*/ use Kilobyteno LaravelPlausible Exceptions PlausibleAPIException ;
try {
$ visitors = Plausible:: getVisitors ( $ domain -> name );
} catch ( PlausibleAPIException $ e ) {
// Handle exception
}composer test 최근에 변경된 내용에 대한 자세한 내용은 ChangElog를 참조하십시오.
자세한 내용은 기여를 참조하십시오.
보안 취약점을보고하는 방법에 대한 보안 정책을 검토하십시오.
MIT 라이센스 (MIT). 자세한 내용은 라이센스 파일을 참조하십시오.