PHP code example of liviu-hariton / pinmeto-laravel
1. Go to this page and download the library: Download liviu-hariton/pinmeto-laravel library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
liviu-hariton / pinmeto-laravel example snippets
return [
'app_id' => env('PINMETO_APP_ID', ''), // the PinMeTo `App ID`
'app_secret' => env('PINMETO_APP_SECRET', ''), // the PinMeTo `App Secret`
'account_id' => env('PINMETO_ACCOUNT_ID', ''), // the PinMeTo `Account ID`
'mode' => env('PINMETO_MODE', 'test'), // the library working mode: `live` or `test` (defaults to `test`)
];
namespace App\Http\Controllers;
use LHDev\PinmetoLaravel\Pinmeto;
class YourController extends Controller
{
public function yourMethod(Pinmeto $pinmeto)
{
$locations = $pinmeto->getLocations();
/* ... rest of your code ... */
}
}
namespace App\Http\Controllers;
use LHDev\PinmetoLaravel\Pinmeto;
class YourController extends Controller
{
public function yourMethod(Pinmeto $pinmeto)
{
$parameters = [
'pagesize' => '2' // Number of locations that the request returns, default 100, max 250
'next' => '569652a91151474860f5e173', // (string) Id of starting point to next page
'before' => '569649b49c5ec8685e11175e', // (string) Id of starting point to previous page
];
$locations = $pinmeto->getLocations($parameters);
/* ... rest of your code ... */
}
}
namespace App\Http\Controllers;
use LHDev\PinmetoLaravel\Pinmeto;
class YourController extends Controller
{
public function yourMethod(Pinmeto $pinmeto)
{
$store_id = 8;
$location_data = $pinmeto->getLocation($store_id);
/* ... rest of your code ... */
}
}
namespace App\Http\Controllers;
use LHDev\PinmetoLaravel\Pinmeto;
class YourController extends Controller
{
public function yourMethod(Pinmeto $pinmeto)
{
$parameters = [
'name' => 'Your store name',
'storeId' => 'your_store_id',
'address' => [
'street' => 'Store address',
'zip' => 'Zipcode',
'city' => 'The City',
'country' => 'The Country',
],
'location' => [
'lat' => 59.333755678571,
'lon' => 18.056143908447,
],
];
$pinmeto->createLocation($parameters);
/* ... rest of your code ... */
}
}
namespace App\Http\Controllers;
use LHDev\PinmetoLaravel\Pinmeto;
class YourController extends Controller
{
public function yourMethod(Pinmeto $pinmeto)
{
$parameters = [
'name' => 'Your store name',
'storeId' => 'your_store_id',
'address' => [
'street' => 'Store address',
'zip' => 'Zipcode',
'city' => 'The City',
'country' => 'The Country',
],
'location' => [
'lat' => 59.333755678571,
'lon' => 18.056143908447,
],
];
$pinmeto->createLocation($parameters, true);
/* ... rest of your code ... */
}
}
namespace App\Http\Controllers;
use LHDev\PinmetoLaravel\Pinmeto;
class YourController extends Controller
{
public function yourMethod(Pinmeto $pinmeto)
{
$store_id = 8;
$parameters = [
'name' => 'The new store name',
'address' => [
'street' => 'The new store address',
'zip' => 'Some other zipcode',
'city' => 'In some other city',
'country' => 'In some other country',
],
];
$pinmeto->updateLocation($store_id, $parameters);
/* ... rest of your code ... */
}
}
namespace App\Http\Controllers;
use LHDev\PinmetoLaravel\Pinmeto;
class YourController extends Controller
{
public function yourMethod(Pinmeto $pinmeto)
{
$metrics = $pinmeto->getMetrics(
source: 'google', // the source can be either `facebook` or `google`
from_date: '2024-01-01', // the format is `YYYY-MM-DD`
to_date: '2024-03-31', // the format is `YYYY-MM-DD`
fields: [
'businessImpressionsDesktopMaps', 'businessImpressionsDesktopSearch'
] // All available fields are described here https://api.pinmeto.com/documentation/v3/
);
/* ... rest of your code ... */
}
}
namespace App\Http\Controllers;
use LHDev\PinmetoLaravel\Pinmeto;
class YourController extends Controller
{
public function yourMethod(Pinmeto $pinmeto)
{
$metrics = $pinmeto->getMetrics(
source: 'facebook', // the source can be either `facebook` or `google`
from_date: '2024-01-01', // the format is `YYYY-MM-DD`
to_date: '2024-03-31', // the format is `YYYY-MM-DD`
store_id: 8
);
/* ... rest of your code ... */
}
}
namespace App\Http\Controllers;
use LHDev\PinmetoLaravel\Pinmeto;
class YourController extends Controller
{
public function yourMethod(Pinmeto $pinmeto)
{
$keywords = $pinmeto->getKeywords(
from_date: '2024-01', // the format is `YYYY-MM`
to_date: '2024-03' // the format is `YYYY-MM`
);
/* ... rest of your code ... */
}
}
namespace App\Http\Controllers;
use LHDev\PinmetoLaravel\Pinmeto;
class YourController extends Controller
{
public function yourMethod(Pinmeto $pinmeto)
{
$keywords = $pinmeto->getKeywords(
from_date: '2024-01', // the format is `YYYY-MM`
to_date: '2024-03', // the format is `YYYY-MM`
store_id: 8
);
/* ... rest of your code ... */
}
}
namespace App\Http\Controllers;
use LHDev\PinmetoLaravel\Pinmeto;
class YourController extends Controller
{
public function yourMethod(Pinmeto $pinmeto)
{
$ratings = $pinmeto->getRatings(
source: 'google', // the source can be either `facebook` or `google`
from_date: '2024-01-01', // the format is `YYYY-MM-DD`
to_date: '2024-03-31' // the format is `YYYY-MM-DD`
);
/* ... rest of your code ... */
}
}
namespace App\Http\Controllers;
use LHDev\PinmetoLaravel\Pinmeto;
class YourController extends Controller
{
public function yourMethod(Pinmeto $pinmeto)
{
$ratings = $pinmeto->getRatings(
source: 'facebook', // the source can be either `facebook` or `google`
from_date: '2024-01-01', // the format is `YYYY-MM-DD`
to_date: '2024-03-31', // the format is `YYYY-MM-DD`
store_id: 8
);
/* ... rest of your code ... */
}
}
namespace App\Http\Controllers;
use LHDev\PinmetoLaravel\Pinmeto;
class YourController extends Controller
{
public function yourMethod(Pinmeto $pinmeto)
{
$network_categories = $pinmeto->getNetworkCategories(
network: 'apple'
);
/* ... rest of your code ... */
}
}
bash
php artisan vendor:publish
text
PINMETO_APP_ID=
PINMETO_APP_SECRET=
PINMETO_ACCOUNT_ID=
PINMETO_MODE=
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.