1. Go to this page and download the library: Download mezon/service library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
mezon / service example snippets
class TodoService extends \Mezon\Service\ServiceBase implements \Mezon\Service\ServiceBaseLogicInterface
{
/**
* First endpoint
*/
public function actionPing()
{
return ('I am alive!');
}
}
\Mezon\Service\Service::start(TodoService::class);
public function actionLongEndpoint()
{
return ('long endpoint');
}
/**
* Logic implementation
*
* @author Dodonov A.A.
*/
class TodoLogic extends \Mezon\Service\ServiceBaseLogic
{
/**
* First endpoint
*/
public function actionPing()
{
return ('I am alive!');
}
}
/**
* Service class
*
* @author Dodonov A.A.
*/
class TodoService extends \Mezon\Service\ServiceBase
{
}
\Mezon\Service\Service::start(TodoService::class, TodoLogic::class);
class CommentLogic extends \Mezon\Service\ServiceBaseLogic
{
/**
* Our endpoint
*/
public function userHeadComment(string $route, array $params)
{
return [
// some data here
];
}
}
[
'userName' => 'name of the user',
'articleId' => 'id of the article',
'headCommentId' => 'comment's id'
]