Magento Expert Forum - Improve your Magento experience

Results 1 to 4 of 4

Integrating PHP function or API with Magento 2

  1. #1
    New member
    Join Date
    Apr 2016
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

  2. #2
    Junior Member
    Join Date
    Jun 2016
    Location
    Bhavnagar, Gujarat, India
    Posts
    1,125
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Default

    You need to implement your custom code in term of any class in extension and then use Magento 2 object manager instance feature to call it. Here is example code in which I have used Magento 2 log functionlity:

    $om = \Magento\Framework\App\ObjectManager::getInstance( );
    $storeManager = $om->get('Psr\Log\LoggerInterface');

    In this code, replace "Psr\Log\LoggerInterface" with your file path and then use $storeManager to call your function like $storeManager->my_function(param1, param2, param3).

  3. #3
    Junior Member
    Join Date
    Aug 2016
    Posts
    72
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Default

    Magento 2 support REST(Representational State Transfer) and SOAP, much like the old version of magento we were used to. Official documentation is mostly based on raw curl request without examples in some specific language. PHP is what we do and there will be many people using it as well.
    There are three user types that have access to API in magento,
    1, Guest user
    2, Administrator/Integration
    3, Customer

  4. #4
    Junior Member
    Join Date
    Sep 2018
    Location
    Canada
    Posts
    873
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default

    went trough on how to configure integration and utilize Magento 2 apis. You would need only two things, module.xml and register.php for Within model we add our functionality that will be executed by call to API method.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •