PHP code example of bryanyeh / shopify-laravel

1. Go to this page and download the library: Download bryanyeh/shopify-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/ */

    

bryanyeh / shopify-laravel example snippets


use Bryanyeh\Shopify\Facades\Shopify;

Route::get('install', function(Request $request){
    return redirect(Shopify::init($request->input('shop'))->install('https://example.com/confirm'));
})->middleware('shopifyrequest');

use Bryanyeh\Shopify\Facades\Shopify;

Route::get('confirm', function(Request $request){
    $access_token = Shopify::init($request->input('shop'))->getAccessToken($request->input('code'))['access_token'];

    //save the access_token for later use

    //redirect to success or billing page

})->middleware('shopifynonce', 'shopifyrequest');

use Bryanyeh\Shopify\Facades\Shopify;

$geturi = '/admin/products/count.json' ;
$posturi = '/admin/products.json';
$puturi = '/admin/products/632910392.json';
$deleteuri = '/admin/products/632910392.json';

$shop = Shopify::init($my_shopify_store,$access_token);
$shop->get($geturi, [if any]);
$shop->post($posturi, [data]);
$shop->put($puturi, [data]);
$shop->delete($deleteuri);
config/app.php
in config/app.php
app/http/Kernel.php

php artisan vendor:publish --provider="Bryanyeh\Shopify\Providers\ShopifyServiceProvider" 
get/post/put/delete
app/Http/Middleware/VerifyCsrfToken.php