### Install Aliyun SMS package
Source: https://github.com/lizhipay/acg-faka/blob/main/vendor/mrgoon/aliyun-sms/README.md
Install the package via Composer.
```bash
composer require mrgoon/aliyun-sms
```
--------------------------------
### Render Installation Environment View
Source: https://github.com/lizhipay/acg-faka/blob/main/app/View/Install.html
This function generates the HTML structure for the environment check page, including status pills, extension grids, and file system permission rows. It also binds event listeners for rechecking the environment and proceeding to the next step.
```javascript
class="name">' + esc(t('env.php')) + ' ' + esc(php.version || '?') + '' + '
'; }
```
--------------------------------
### Recheck Environment
Source: https://github.com/lizhipay/acg-faka/blob/main/app/View/Install.html
Initiates a recheck of the environment status, updating the UI with a loading state.
```javascript
var rechecking = false; function recheck(manual) { if (rechecking) return; rechecking = true; var btn = panel.querySelector('#recheck'); if (manual && btn) { btn.classList.add('loading');
```
--------------------------------
### Send SMS in non-Laravel environments
Source: https://github.com/lizhipay/acg-faka/blob/main/vendor/mrgoon/aliyun-sms/README.md
Manually configure and use the AliSms class outside of the Laravel framework.
```php
$config = [
'access_key' => 'your access key',
'access_secret' => 'your access secret',
'sign_name' => 'your sign name',
];
$aliSms = new Mrgoon\AliSms\AliSms();
$response = $sms->sendSms('phone number', 'tempplate code', ['name'=> 'value in your template'], $config);
```
--------------------------------
### Fallback Copy Implementation
Source: https://github.com/lizhipay/acg-faka/blob/main/app/View/Install.html
Provides a fallback mechanism for copying text to the clipboard using a temporary textarea element.
```javascript
function fallbackCopy(text) { var ta = document.createElement('textarea'); ta.value = text; ta.setAttribute('readonly', ''); ta.style.position = 'fixed'; ta.style.opacity = '0'; document.body.appendChild(ta); ta.select(); try { document.execCommand('copy'); } catch (e) {} document.body.removeChild(ta); }
```
--------------------------------
### Register Laravel Service Provider
Source: https://github.com/lizhipay/acg-faka/blob/main/vendor/mrgoon/aliyun-sms/README.md
Add the service provider to the providers array in config/app.php.
```php
Mrgoon\AliSms\ServiceProvider::class
```
--------------------------------
### Bind Copy Functionality
Source: https://github.com/lizhipay/acg-faka/blob/main/app/View/Install.html
Attaches click listeners to elements with data-copy attributes to copy text to the clipboard.
```javascript
function bindCopy(view) { view.querySelectorAll('\[data-copy\]').forEach(function (b) { b.addEventListener('click', function () { var text = b.getAttribute('data-copy'); var done = function () { toast(t('btn.copied')); }; if (navigator.clipboard && window.isSecureContext) navigator.clipboard.writeText(text).then(done, function () { fallbackCopy(text); done(); }); else { fallbackCopy(text); done(); } }); }); }
```
--------------------------------
### Send SMS in Laravel
Source: https://github.com/lizhipay/acg-faka/blob/main/vendor/mrgoon/aliyun-sms/README.md
Use the AliSms class to send an SMS message within a Laravel application.
```php
$aliSms = new AliSms();
$response = $aliSms->sendSms('phone number', 'SMS_code', ['name'=> 'value in your template']);
//dump($response);
```
--------------------------------
### Generate Status Pill
Source: https://github.com/lizhipay/acg-faka/blob/main/app/View/Install.html
Helper function to create a status pill component with an icon and translated text.
```javascript
function pill(ok, key) { return '' + (ok ? 'check' : 'close') + '' + esc(t(key)) + ''; }
```