title: Creating laravel service class
body: <p>My Uptime.php </p>
  
  <pre><code>&lt;?php 
  
  $curl = curl_init();
  
  curl_setopt_array($curl, array(
  CURLOPT_URL =&gt; "https://api.uptimerobot.com/v2/getMonitors",
  CURLOPT_RETURNTRANSFER =&gt; true,
  CURLOPT_ENCODING =&gt; "",
  CURLOPT_MAXREDIRS =&gt; 10,
  CURLOPT_TIMEOUT =&gt; 30,
  CURLOPT_HTTP_VERSION =&gt; CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST =&gt; "POST",
  CURLOPT_POSTFIELDS =&gt; "Your Api Key",
  CURLOPT_HTTPHEADER =&gt; array(
    "cache-control: no-cache",
    "content-type: application/x-www-form-urlencoded"
   ),
  ));
  
  $response = curl_exec($curl);
  $err = curl_error($curl);
  
  curl_close($curl);
  
   if ($err) {
     echo "cURL Error #:" . $err;
  } else {
  $data = json_decode($response);
  $custom_uptime = ($data-&gt;monitors[0]-&gt;custom_uptime_ratio);
  $uptime = explode("-",$custom_uptime);
  }
  
  ?&gt;
  </code></pre>
  
  <p>ApiCommand.php </p>
  
  <pre><code>public function handle()
  {
     //include(app_path() . '/Includes/Uptime.php')
     $this-&gt;showMonitors();
  }
  
  public function showMonitors(UptimeRobotAPI $uptime_api)
  {
      $monitors = $uptime_api-&gt;getMonitors();
  
      return $monitors;
  }
  </code></pre>
  
  <p>Hello everyone. I just want to ask how can I turn this to a service class? Do I need to use service providers or service containers? Thanks in advance.</p>
  
  <p>Someone convert it to service class and here was my command looks like. </p>