How to create a php service

Hi , i have tried to create a php service with the following …

<?php
class myClass 
{
    function myClass(p1,p2){
         return p1;
    }

  private function getObjArr($object){
      return (array)$object;
   }

}

   //----- main 
  $verb = $event['request']['method'];

  if($verb !== 'GET'){
throw new \DreamFactory\Core\Exceptions\BadRequestException('Only HTTP GET is allowed on this endpoint.');
   }

  // -----> the rest of the call 
  $mc = new myClass( 1 , 2 ) ;
  ...
  ?>

my question is that will my php code with the class defined like above work ?
appreciate any advice.

thanks,
kalmen

I like to code and develop a website, I am not a professional. I saw my friend coding who provides the Assignment Service as well and I get interested in it, so I want to learn PHP coding because I know HTML. Can anyone suggest me a good online place to learn coding?

How to create php email service providing?