Download the PHP package walkboy/yii2-sms without Composer

On this page you can find all versions of the php package walkboy/yii2-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 yii2-sms

Yii2 SMS

This is the base library for providing SMS support in your Yii2 application. You can make your own plugins for SMS providers off this base package. It is not to be directly used.

NOTE: You can not use this library/package by itself. It is a parent/root package meant to be extended from! See Yii2 SMS Twilio for an example on how to make your own plugin extending this package.

This is just like the base mail namespace in Yii2. You don't use it directly, but rather use the Swiftmailer package which extends the built-in yii\mail classes.

The goal is to send SMS text messages similar to how you send emails in Yii2 and to be easily extended on to support an infinite number of SMS providers.

This package originaly was created by @WadeShuler but author removed it from Github and abandoned package maintenance.

Key take-aways

Configuration is in your main config (Advanced: common/config/main-local.php) as the sms component:

Note: The above configuration is only an example and will not actually send SMS messages. You will need to make your own Sms class that extends BaseSms, as well as your own class that extends BaseMessage. Your extended classes will handle the logic for using your own SMS service provider of choice. My Yii2 SMS Twilio extension is a great example of how to make a plugin for this package.

When useFileTransport is set to true, it will dump the text messages in the fileTransportPath which defaults to @runtime/sms. I have made slight modifications so these are more readable.

Use the messageConfig array to set default message configurations, such as from, as the Message class will be instantiated with them automatically via the "getters" and "setters", thanks to Yii::createObject().

You can set API key params in the sms configuration array directly, not inside messageConfig, as they have to do with the transport (SMS provider) and not the message specifically. Note: apiKey is not defined in this package, and was simply an example of where to place them.

The viewPath defaults to @app/sms, same as the Yii2 mailer, and can be overridden in the config. This is for using a view file, specified within the compose() function, similar to the Yii2 mailer.

Note: There are only "text" views. Since these are text messages, HTML views are not applicable. Therefore you just pass the view as a string, not an array with a text param in it! I removed that to streamline usage, as it made more sense to take it out.

View file example:

Yii::$app->sms->compose('test-message', ['name' => 'Wade'])

Where test-message is a view file located in the viewPath destination.

View File: common/sms/test-message.php

You will need to create the sms directory, as well as the view file, if you intend on using views and not just setting the message directly with setMessage().

Without view file example:

Yii::$app->sms->compose()
    //->setFrom('12345')  // if not set in config, or to override
    ->setTo('+15558881234')
    ->setMessage("Hey {$name} this is a test!\n\nThanks!")
    ->send();

If you set the from number in the main config, under the messageConfig array, you do not need to call setFrom() unless you want to override the number that was configured.

So how do I use this?

I recommend you look at Yii2 SMS Twilio package. You will see in the composer.json that it requires this package. It's Sms class extends this BaseSms, and Message extends this BaseMessage.

Packages using this library

Want to add yours to the list? Create an issue and I will add it so long as it works and extends this base package.


All versions of yii2-sms with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.0
yiisoft/yii2 Version ~2.0.11
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 walkboy/yii2-sms contains the following files

Loading the files please wait ....