mailup rest client
1.0.0
Fazland의 Mailup Rest Client는 이메일 및 SMS GatewayProvider Mailup의 비공식 PHP REST 클라이언트입니다.
제안 된 설치 방법은 작곡가를 통해입니다.
$ composer require fazland/mailup-rest-client정말 간단합니다. 우선, 구성!
필수 구성 매개 변수는 다음과 같습니다.
usernamepasswordclient_idclient_secret 유일한 선택적 매개 변수는 cache_dir 입니다. 설정하면 액세스 토큰이 해당 경로에 저장됩니다.
생성자에게 배열로 전달되는 Context 객체를 만듭니다.
use Fazland MailUpRestClient Context ;
$ config = [
' username ' => ' your_username ' ,
' password ' => ' your_password ' ,
' client_id ' => ' your_client_id ' ,
' client_secret ' => ' your_client_secret ' ,
' cache_dir ' => ' path_to_your_cache_dir ' , // Optional
];
$ httpClient = new HttpClientImplementation ();
$ context = new Context ( $ config , $ httpClient ); MailingList 만들려면이 예제를 따라갈 수 있습니다. $params 배열에 대해서는 Mailup 공식 API 문서를 참조하십시오.
use Fazland MailUpRestClient MailingList ;
$ email = " [email protected] " ;
$ listName = " list_name " ;
$ params = [
// your params...
];
$ list = MailingList:: create ( $ context , $ listName , $ email , $ params ); 정적 메소드 MailingList::getAll() 호출하여 Mailup 계정의 모든 목록을 얻을 수도 있습니다.
use Fazland MailUpRestClient MailingList ;
$ lists = MailingList:: getAll ( $ context ); MailingList 인스턴스가 있으면 다음 작업을 수행 할 수 있습니다.
Recipient 를 추가하십시오 use Fazland MailUpRestClient Recipient ;
$ list -> addRecipient ( new Recipient ( ' Aragorn ' , ' [email protected] ' , ' 3333333333 ' , ' +39 ' ));Recipient 업데이트하십시오 use Fazland MailUpRestClient Recipient ;
$ list -> updateRecipient ( new Recipient ( ' Aragorn ' , ' [email protected] ' , ' 3334444444 ' , ' +39 ' ));Recipient 제거하십시오 use Fazland MailUpRestClient Recipient ;
$ list -> removeRecipient ( new Recipient ( ' Aragorn ' , ' [email protected] ' , ' 3333333333 ' , ' +39 ' ));email 로 Recipient 찾으십시오 $ recipient = $ list -> findRecipient ( ' [email protected] ' ); // null returned if current email was not found $ groups = $ list -> getGroups (); $ countRecipients = $ list -> countRecipients (); // equal to $list->countRecipients(Recipient::STATUS_SUBSCRIBED);
// OR
$ countRecipients = $ list -> countRecipients (Recipient:: STATUS_UNSUBSCRIBED );
// OR
$ countRecipients = $ list -> countRecipients (Recipient:: STATUS_PENDING ); $ recipients = $ list -> getRecipientsPaginated ( $ pageNumber , $ pageSize );Recipient 개체의 배열을 가져옵니다. $ list -> import ( $ recipients ); 각 MailingList 여러 그룹으로 나눌 수 있습니다. 사용 가능한 작업은 다음과 같습니다.
$ group -> getName ();
$ group -> setName ( ' Gondor Army ' ); $ group -> getNotes ();
$ group -> setNotes ( ' 10.000 knights and 20.000 peons ' ); $ group -> isDeletable ();
$ group -> setDeletable ( true ); $ group -> delete (); use Fazland MailUpRestClient Recipient ;
$ legolas = new Recipient ( ' Legolas Thranduilion ' , ' [email protected] ' , ' 3334444444 ' , ' +39 ' );
$ group -> addRecipient ( $ legolas );
$ group -> removeRecipient ( $ legolas );
$ lothlorienCitizens = $ group -> getRecipients ();기부금을 환영합니다. Github에서 PR을 열거나 여기에 문제를 제출하십시오!
Mailup Rest Client는 MIT 라이센스에 따라 라이센스가 부여됩니다. 자세한 내용은 라이센스 파일을 참조하십시오.