/marketo-client-php

Marketo REST API PHP Client

Primary LanguagePHPMIT LicenseMIT

Marketo REST API PHP Client [WIP]

Software License Build Status

It's work in progress. Use at your own risk.

Contents

Installation

You can install the package via composer:

composer require pmatseykanets/marketo-client

Usage

When instantiating a client you can pass an array of following parameters

  • client_id
  • client_secret
  • base_url
  • partner_id (optional)
$config = [
    // required (credentials below are not real)
    'client_id' => '02d92ff0-9d94-4de7-b152-3df68969b947',
    'client_secret' => 'bB6wmEvjlsfVr1Vs3NfGwSD9HL2AAHzZ',
    'url' => 'https://123-XYZ-456.mktorest.com'
    // optional
    'partner_id' => '123456789'
];

$marketo = new Client($config);

Alternatively the client can read parameters from the following environment variables

  • MARKETO_CLIENT_ID
  • MARKETO_CLIENT_SECRET
  • MARKETO_URL
  • MARKETO_PARTNER_ID
$marketo = new Client();

Endpoints that may have multiple pages of results return generators so they can be easily iterated over

$request = $marketo->leadDatabase()->getLists(); 
foreach ($request->send() as $response) {
    foreach ($response->result ?? [] as $list) {
        // do something with a list
    }
}

Marketo REST API Coverage

  • LeadDatabase
    • Activities
      • GetActivities
      • GetActivityTypes
      • GetDeletedActivities
      • GetLeadChangesActivities
      • GetPagingToken
      • AddCustomActivities
      • CreateCustomActivityType
      • DeleteCustomActivityType
      • DiscardCustomActivityTypeDraft
      • UpdateCustomActivityType
      • ApproveCustomActivityType
      • CreateCustomActivityTypeAttributes
      • DeleteCustomActivityTypeAttributes
      • UpdateCustomActivityTypeAttributes
    • BulkCustomObjects
    • BulkExportActivities
    • BulkExportLeads
    • BulkLeads
    • Campaigns
      • FindCampaign
      • GetCampaigns
      • ScheduleCampaign
      • TriggerCampaign
    • Companies
      • DescribeCompany
      • GetCompanies
      • SyncCompanies
      • DeleteCompanies
    • CustomObjects
      • DeleteCustomObjects
      • DescribeCustomObject
      • GetCustomObjects
      • GetCustomObjectTypes
      • SyncCustomObjects
    • Leads
      • AssociateLead
      • DeleteLeads
      • DescribeLead
      • GetLeadPartitions
      • GetLeads
      • MergeLeads
      • PushLeads
      • SyncLeads
      • UpdateLeadPartition
      • GetLeadsByProgramId
      • ChangeLeadProgramStatus
    • Lists
      • AddToList
      • DeleteFromList
      • FindList
      • GetListLeads
      • GetLists
      • IsListMember
    • NamedAccountLists
    • NamedAccounts
    • Opportunities
    • SalesPersons
    • Usage
  • Assets
    • Channels
    • EmailTemplates
    • Emails
    • FileContents
    • Files
    • Folders
    • FormFields
    • Forms
    • LandingPageContent
    • LandingPageTemplates
    • LandingPages
    • Programs
    • Segments
    • SmartCampaigns
    • SmartLists
    • StaticLists
    • Tags
    • Tokens
  • Identity
    • GetOAuthToken

Changelog

Please see CHANGELOG for more information about what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Credits

License

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