tobya/bcsapiwrapper

BCS Api Wrappers

v4.22 2024-05-26 07:13 UTC

README

BCS API Wrapper Library BCSAPI Library V4

Latest Stable Version Total Downloads Latest Unstable Version License

install

 composer require tobya/bcsapiwrapper

Publish config file

php artisan vendor:publish

select BCSApiWrapper

.env updates The following values need to be available in .env file

# Main BCS Api URLS
BCSBACKOFFICE_APIURL=
BCSBACKOFFICE_APIKEY=

# New BCS V4 Api Urls / V3 discontinued
BCSBACKOFFICE_V4_APIURL=
BCSBACKOFFICE_V4_APITOKEN=


# Photo Api
DEMOPHOTO_APIURL=

#Recipe Api
BCSRECIPE_APIURL=
BCSRECIPE_APIKEY=

Keep up to date

composer update

Upgrading from V2

You need to add the following to config/bcsapi.php

  'v4' => [
            'backoffice' => [
                'url' => env('BCSBACKOFFICE_V4_APIURL',''),
                'token' => env('BCSBACKOFFICE_V4_APITOKEN',''),
            ],
        ]

and .env is

BCSBACKOFFICE_V4_APIURL={base host url, not api.backoffice.ie}
BCSBACKOFFICE_V4_APITOKEN={sanctum token}

V2 BCSApiWrapper

$CourseApi =  App('BCSApi')->Course();
$CourseInfo = $CourseApi->CourseInfo(12345);
echo $CourseInfo->CourseName;

V4 BCSApiWrapper

$CourseApi = BCSLoader::Course();
$CourseInfo = $CourseApi->CourseInfo(12345);
echo $CourseInfo->CourseName;

This may require rewriting of quite a bit of code on upgrading.

Tests

There is a Postman Collection to do tests on the main BCSApi routes.

https://github.com/tobya/bcsStudents_gitp4/blob/LaravelSubscriptions/resources/postman/api.cookingisfun.ie%20v2.postman_collection.json