Download the PHP package netgsm/sms without Composer

On this page you can find all versions of the php package netgsm/sms. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package sms

Netgsm SMS API v3 PHP İstemcisi

Netgsm SMS API v3 için PHP istemcisi. Laravel, Symfony ya da düz PHP projelerinde kullanılabilir.

v2 kullanıyorsanız: v3.0.0 geriye uyumlu değildir. Mevcut kodunuzu değiştirmek istemiyorsanız composer.json dosyanızda "netgsm/sms": "^2.0" kısıtını koruyun; 2.x sürümleri çalışmaya devam eder. Geçiş için v2'den v3'e geçiş bölümüne bakın.

Gereksinimler

Kurulum

Kimlik bilgilerini .env dosyanızda tutun; koda ya da sürüm kontrolüne yazmayın:

Hızlı başlangıç

Numaralar E.164 biçiminde yazılır: +90 ve 10 rakam (+905321234567), yurt dışı için + ve ülke kodu (+4915112345678).

Token önbelleği

İstemci, kullanıcı adı ve şifreyle bir kez token alır ve süresi dolana kadar bu token'ı kullanır. Token alma isteği IP başına dakikada 30 ile sınırlıdır. PHP-FPM'de her web isteği ayrı bir süreç olduğundan, token'ın süreçler arasında paylaşılması için bir PSR-16 cache verin:

Cache verilmezse token yalnızca nesne yaşadığı sürece bellekte tutulur. Bu, CLI betikleri ve kuyruk işçileri için yeterlidir.

Laravel

App\Providers\AppServiceProvider içinde:

Config cache kullanıyorsanız (php artisan config:cache) env() çağrılarını config/services.php dosyasına taşıyın ve burada config('services.netgsm.username') gibi okuyun.

Symfony

config/services.yaml:

Metotlar

Bütün metotlar API'nin döndürdüğü JSON'u dizi olarak döndürür. Alanların açıklaması her metodun yanındaki resmî doküman sayfasındadır.

Metot Uç nokta Doküman
send($sender, $messages, $options) POST /sms/v3/send send-sms
cancel($jobId) POST /sms/v3/cancel cancel-job
report($jobIds, $startAt, $stopAt, $page) GET /sms/v3/report read-reports
inbox($startAt, $stopAt) GET /sms/v3/inbox read-inbox
senders() GET /sms/v3/senders list-senders
blacklist($numbers, $page, $pageTotal) GET /sms/v3/blacklist kara-liste
addToBlacklist($numbers) POST /sms/v3/blacklist kara-liste
removeFromBlacklist($numbers) DELETE /sms/v3/blacklist kara-liste
balance($stip, $service) GET /sms/v3/balance get-balance

Gönderim

Bütün alıcılar tek send() çağrısında gönderilir; alıcı başına ayrı çağrı yapmayın. Bir istek 1.000.000 kayda kadar taşır ve her kaydın kendi metni olabilir.

Yanıttaki status SCHEDULED ise görev başlangıç zamanına kadar cancel() ile iptal edilebilir; QUEUED ise gönderim başlamıştır.

Rapor

Sayfa başına en fazla 100 satır döner. Aynı görev dakikada bir sorgulanabilir. Raporu henüz gelmemiş alıcılar listede yer almaz.

Gelen SMS

Tarih verilmezse içinde bulunulan ay döner. Aralık en fazla 2 ay olabilir. Yanıt en fazla 500 mesaj taşır; truncated true ise aralığı daraltarak tekrar sorgulayın.

Kara liste

Ekleme ve silme istek başına en fazla 100 numara alır.

Bakiye

Büyük bir gönderimden önce bir kez sorgulayın; her mesajdan önce sorgulamayın. Kredi Bakiye değeri virgüllü bir metindir ("92,150", yani 92,15 TL).

Hata yönetimi

API hata döndürdüğünde ya da yanıt alınamadığında Netgsm\Sms\NetgsmException fırlatılır.

Alan Açıklama
status HTTP durum kodu. Yanıt alınamadıysa 0.
errorCode API'nin hata kodu: REJECTED_HEADER, INVALID_REQUEST, RATE_LIMITED, invalid_credentials vb. Yanıt alınamadıysa NETWORK_ERROR.
requestId Destek talebinde paylaşılacak istek kimliği.
retryAfter 429 yanıtında kaç saniye sonra tekrar denenebileceği.
mayHaveBeenQueued Gönderimde sunucu hatası ya da bağlantı hatası olduysa true.
violations 400 yanıtında hangi alanın neden reddedildiği.
rejectedItems 422 NO_DELIVERABLE_MESSAGES yanıtında reddedilen kayıtlar ve nedenleri.

Hata mantığını HTTP durum koduna değil errorCode alanına göre kurun. Kodların tamamı ve anlamları: api-docs.netgsm.com.tr.

İstemci yalnızca bir durumda kendiliğinden tekrar dener: token geçersiz olduğunda (401) bir kez yeniden giriş yapar ve isteği bir kez tekrarlar. Başka hiçbir isteği tekrarlamaz ve beklemez.

Güvenlik

Test

Gerçek hesabınızı kullanmadan denemek için Netgsm'in SMS göndermeyen sandbox ortamını kullanabilirsiniz:

Demo hesaplar ve şifreler: SMS API v3 sandbox.

Paketin kendi testleri:

v2'den v3'e geçiş

v3, Netgsm'in eski API'si yerine SMS API v3'ü kullanır. Sınıf, metotlar, parametreler ve dönüş biçimi değişti. v2'de kalmak isteyenler "netgsm/sms": "^2.0" kısıtını korur.

v2 v3
new SmsSend() ($_ENV okur) new NetgsmClient($username, $password, $cache)
NETGSM_USERCODE, NETGSM_PASSWORD Abone numarası ve API alt kullanıcısı şifresi, constructor'a verilir
NETGSM_HEADER send() metodunun ilk parametresi ($sender)
smsGonder() (1:n), smsGonderNN() (n:n), smsgonder1_1() send(): her kayıt ['recipient' => ..., 'text' => ...]
smsSorgulama() report()
gelensms() inbox()
basliksorgu() senders()
karaliste() ekleme / çıkarma addToBlacklist() / removeFromBlacklist(); sorgu için blacklist()
— cancel(), balance()

Parametreler:

v2 v3
no, gsm (5xx, 05xx, 905xx) recipient, E.164: +905321234567
encoding = TR encoding = TURKISH
startdate, stopdate (ddMMyyyyHHmm) startAt, stopAt (DateTimeInterface)
filter iysFilter: NONE, BRAND, RETAILER, BRAND_AND_RETAILER
bayikodu partnerCode
bulkid jobId

Davranış farkları:

Destek

Lisans

MIT


All versions of sms with dependencies

PHP Build Version
Package Version
Requires php Version >=8.2
ext-curl Version *
ext-json Version *
psr/simple-cache Version ^1.0 || ^2.0 || ^3.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package netgsm/sms contains the following files

Loading the files please wait ...