Skip to content

topix-hackademy/laravel-contact-tool-sdk

Repository files navigation

laravel-contact-tool-sdk

Laravel Set of Classes to perform access to Contact and Company data models and maintain local references.

Install

Add Packge dependencies to project composer.json:

   "require": {
       ...
       "topix-hackademy/laravel-contact-tool-sdk": "^0.0.1"
   },

   ...

   "repositories": [
       {
           "type": "git",
           "url": "https://github.com/topix-hackademy/laravel-contact-tool-sdk.git"
       }
   ]

Launch a composer update

Add Service Provider to /config/app.php

   'providers' => [
           ...
           Topix\Hackademy\ContactToolSdk\ServiceProvider::class,

Publish package files with: php artisan vendor:publish

Update the autoloader with: composer dump-autoload

Usage

Setup

To have access to remote API you need to set in /config/anagrafica.php:

Classes

Contact Tool Class

Contact tool class work in conjunctin with a Laravel Model that implements iReferable interface to manage local and remote data,

To use a laravel model with 'Contac Tool':

  • Model must implement 'iReferable' interface (Topix\Hackademy\ContactToolSdk\Contact\Contracts\iReferable)
  • Model can use standard implementation of 'iReferable interface' with 'Referable' Trait (Topix\Hackademy\ContactToolSdk\Contact\Traits)
Method Parameters Usage
getReference iReferable Get Reference data related to this model
createContact iReferable, data Create Remote Contact Related data and local Relations
createCompany iReferable, data Create Remote Company Related data and local Relations
updateReference iReferable, data Update Remote Reference Related data and local Relations
API Classes

Set of object that reflects entities on remote API

API Available classes are : Company, Contact, CompanyType, ContactType

Method Parameters Usage
all * Get all the entities
get id Get an entity with the provoded ID
create data Crate an entity
update id, data Update the entity with the provided ID
delete id Delte the entity with the provided ID
Facade

If you want to use the ContactTool Facade Aliases you need to include an alias in /config/app.php

    'aliases' => [
		'ContactTool' => \Topix\Hackademy\ContactToolSdk\Contact\Facades\ContactTool::class,
		'Contact' => \Topix\Hackademy\ContactToolSdk\Contact\Facades\Contact::class,
        'ContactType' => \Topix\Hackademy\ContactToolSdk\Contact\Facades\ContactType::class,
        'Company' => \Topix\Hackademy\ContactToolSdk\Contact\Facades\Company::class,
        'CompanyType' => \Topix\Hackademy\ContactToolSdk\Contact\Facades\CompanyType::class,

Trait

You can use the 'Refereable' Trait (Topix\Hackademy\ContactToolSdk\Contact\Traits) in every class tha extends Topix\Hackademy\ContactToolSdk\Contact\Contracts\iReferable

License

The MIT License (MIT). Please see License File for more information.

About

Laravel Contact Tool SDK

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages