{"id":16233501,"url":"https://github.com/karser/smsbundle","last_synced_at":"2025-04-03T10:30:37.025Z","repository":{"id":8562654,"uuid":"10189010","full_name":"karser/SMSBundle","owner":"karser","description":null,"archived":false,"fork":false,"pushed_at":"2014-02-08T12:37:10.000Z","size":200,"stargazers_count":2,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-18T22:36:59.961Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/karser.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-05-21T06:00:57.000Z","updated_at":"2015-10-30T23:53:24.000Z","dependencies_parsed_at":"2022-09-05T05:40:31.888Z","dependency_job_id":null,"html_url":"https://github.com/karser/SMSBundle","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karser%2FSMSBundle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karser%2FSMSBundle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karser%2FSMSBundle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karser%2FSMSBundle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/karser","download_url":"https://codeload.github.com/karser/SMSBundle/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246984409,"owners_count":20864434,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-10T13:12:51.976Z","updated_at":"2025-04-03T10:30:36.195Z","avatar_url":"https://github.com/karser.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"Getting started with SMSBundle\n=============\n\n## Prerequisites\n\nThis version of the bundle requires Symfony 2.1+ and Doctrine ORM 2.2+\n\n## Installation\n\n### Step 1: Download KarserSMSBundle using composer\n\nAdd KarserSMSBundle in your composer.json:\n\n```js\n{\n    \"require\": {\n        \"karser/sms-bundle\": \"dev-master\",\n    }\n}\n```\n\nNow tell composer to download the bundle by running the command:\n\n``` bash\n$ php ./composer.phar update\n```\n\nComposer will install the bundle to your project's `vendor/karser` directory.\n\n### Step 2: Enable the bundle\n\nEnable the bundle in the kernel:\n\n``` php\n\u003c?php\n// app/AppKernel.php\n\npublic function registerBundles()\n{\n    $bundles = array(\n        // ...\n        new Karser\\SMSBundle\\KarserSMSBundle(),\n    );\n}\n```\n\n### Step 3: Configure the KarserSMSBundle\n\nAdd the following configuration to your `config.yml` file according to which type\nof datastore you are using.\n\n``` yaml\n# app/config/config.yml\nkarser_sms:\n    sms_task_class: Acme\\SMSBundle\\Entity\\SmsTask\n    default_handler: karser.handler.main_sms #or karser.handler.sms_vesti\n```\n\nUpdate your schema:\n```\napp/console doctrine:schema:update --force\n```\n### Step 4: Implement the sms_task entity\n\n``` php\n\u003c?php\nnamespace Your\\Module\\Entity;\n\nuse Karser\\SMSBundle\\Entity\\SmsTask as BaseClass;\nuse Doctrine\\ORM\\Mapping as ORM;\n\n/**\n * @ORM\\Table\n * @ORM\\Entity\n * @ORM\\HasLifecycleCallbacks\n */\nclass SmsTask extends BaseClass\n{\n    /**\n     * @ORM\\Column(type=\"string\", length=20)\n     *\n     * @var string\n     */\n    protected $ipAddress;\n\n    /**\n     * @ORM\\Column(type=\"string\", length=50)\n     *\n     * @var string\n     */\n    protected $sessionId;\n\n    /**\n     * @ORM\\Column(type=\"bigint\", nullable=true)\n     *\n     * @var int\n     */\n    protected $userId;\n\n    /**\n     * @var \\DateTime\n     *\n     * @ORM\\Column(type=\"datetime\", nullable=false)\n     */\n    protected $createdAt;\n\n    /**\n     * @ORM\\PrePersist\n     */\n    public function prePersist() {\n        $this-\u003ecreatedAt = new \\DateTime();\n    }\n\n    /**\n     * @param string $sessionId\n     */\n    public function setSessionId($sessionId)\n    {\n        $this-\u003esessionId = $sessionId;\n    }\n\n    /**\n     * @return string\n     */\n    public function getSessionId()\n    {\n        return $this-\u003esessionId;\n    }\n\n    /**\n     * @param int $userId\n     */\n    public function setUserId($userId)\n    {\n        $this-\u003euserId = $userId;\n    }\n\n    /**\n     * @return int\n     */\n    public function getUserId()\n    {\n        return $this-\u003euserId;\n    }\n\n    /**\n     * @param string $ipAddress\n     */\n    public function setIpAddress($ipAddress)\n    {\n        $this-\u003eipAddress = $ipAddress;\n    }\n\n    /**\n     * @return string\n     */\n    public function getIpAddress()\n    {\n        return $this-\u003eipAddress;\n    }\n\n    /**\n     * Set createdAt\n     *\n     * @param \\DateTime $createdAt\n     * @return SmsTask\n     */\n    public function setCreatedAt($createdAt)\n    {\n        $this-\u003ecreatedAt = $createdAt;\n\n        return $this;\n    }\n\n    /**\n     * Get createdAt\n     *\n     * @return \\DateTime\n     */\n    public function getCreatedAt()\n    {\n        return $this-\u003ecreatedAt;\n    }\n}\n```\n\n### Step 5: Available backends\n\n- [MainSMS](http://mainsms.ru/): [KarserMainSMSBundle](https://github.com/karser/MainSMSBundle)\n- [SMSVesti](http://smsvesti.ru/): [KarserSMSVestiBundle](https://github.com/karser/SMSVestiBundle)\n\n\n### Usage Steps\n``` php\n$task = new \\Your\\Module\\Entity\\SmsTask();\n$task-\u003esetPhoneNumber('+799999999999');\n$task-\u003esetMessage('ni hao');\n$task-\u003esetSender('your_friend');\n\n$handler = $container-\u003eget('karser.sms.manager')-\u003egetDefaultHandler();\n$msg_id = $handler-\u003esend($task);\n$status = $handler-\u003echeckStatus($task-\u003egetMessageId());\nif ($status === SMSTaskInterface::STATUS_PROCESSING) {\n    //is sent\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkarser%2Fsmsbundle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkarser%2Fsmsbundle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkarser%2Fsmsbundle/lists"}