J
J
jbadis2019-09-25 17:31:05
Composer
jbadis, 2019-09-25 17:31:05

How to initialize a function via composer?

Created a simple library via composer with one function:

namespace ing;
function amocrmErrors ($getCode, $getMessage,$domen){
  
  $data = array(
  'getCode' => $getCode, 
  'getMessage' =>$getMessage,
  'domen' => $domen	
  );
  
  $url = 'любой урл';
    $ch = curl_init($url);
    $encodedData = $data;

    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $encodedData);
  curl_setopt($ch, CURLOPT_USERAGENT,'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.154 Safari/537.36');  
    curl_setopt($ch, CURLOPT_HTTPHEADER, array('application/x-www-form-urlencoded'));
    curl_exec($ch);
    curl_close($ch);    
}

composer.json file
{
    "name": "ing/amolib",
    "description": "lib",
    "type": "library",
  "license": "MIT",
  
    "authors": [
        {
            "name": "ing",
            
        }
    ],	
    "minimum-stability": "dev",
    "prefer-stable": true,	
  "autoload": {
    "psr-4": {
            "ing\\": "src"        
    }
  },
    "require-dev": {
  "ing/amolib" : "dev-master"	
  },


  "require": {
        "php": ">=5.3.0"
}

}

When declaring a function: I get an
amocrmErrors($getCode, $getMessage,$domen );
error: Fatal error: Uncaught Error: Call to undefined function amocrmErrors() in..
Where am I wrong? Or do you need to work through classes through composer?
Thank you!

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question