PHP code example of headsnet / sms-bundle

1. Go to this page and download the library: Download headsnet/sms-bundle 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/ */

    

headsnet / sms-bundle example snippets


public function registerBundles()
{
    $bundles = array(
        // ...
        new Headsnet\SmsBundle\HeadsnetSmsBundle(),
    );
}


declare(strict_types=1);

namespace AppBundle\Sms;

use Headsnet\Sms\Mapping\TemplateMappingInterface;

/**
 * Map template reference names to template paths
 */
class Mapping implements TemplateMappingInterface
{
	/**
	 * @return array
	 */
	public function getMappings()
	{
		return [
			'customer.confirm' => '@AppBundle/sms/customer.confirm.text.twig',
			'customer.reminder' => '@AppBundle/sms/customer.reminder.text.twig'
		];
	}
}

namespace Company\App;

use Headsnet\Sms\SmsSendingInterface;

class MyService
{
    private $smsSending;
        
    public function __construct(SmsSendingInterface $smsSending)
    {
        $this->smsSending = $smsSending;
    }

    public function doSomething()
    {
        // How to access factory to create SMS instances
        $factory = $this->smsSending->getFactory();
        
        // How to access sender to send or queue the SMS
        $smsSender = $this->smsSending->getSmsSender();
    }
}