|
| 1 | +# PHP Laravel Cpanel |
| 2 | +A php laravel package to manage Cpanel email accounts |
| 3 | + |
| 4 | +## Installation |
| 5 | +``` |
| 6 | +composer require naif/php-cpanel-email |
| 7 | +``` |
| 8 | + |
| 9 | +Add service provider and alias to config/app.php |
| 10 | +``` |
| 11 | +Under Providers: |
| 12 | +\Naif\CpanelMail\CpanelServiceProvider::class, |
| 13 | +
|
| 14 | +Under aliases: |
| 15 | +'SaudiAddress' => Naif\Saudiaddress\Facades\SaudiAddress::class, |
| 16 | +``` |
| 17 | +## API KEYS |
| 18 | +Obtain your National Address API key from https://api.address.gov.sa/ |
| 19 | + |
| 20 | +Add these to your .env |
| 21 | +``` |
| 22 | +CPANEL_DOMAIN=your_domain.com |
| 23 | +CPANEL_HOST=https://your_domain.com |
| 24 | +CPANEL_PORT=2083 // cpanel port Default is: 2083 |
| 25 | +CPANEL_VERSION=2 // cpanel api current version |
| 26 | +CPANEL_USERNAME=your_cpanel_username |
| 27 | +CPANEL_PASSWORD=your_cpanel_password |
| 28 | +``` |
| 29 | +## Usage |
| 30 | + |
| 31 | +Create a class object |
| 32 | +```php |
| 33 | +$cpanel = new Cpanel() |
| 34 | +``` |
| 35 | + |
| 36 | +Get a list of all email addresses |
| 37 | +``` |
| 38 | +$cpanel->getEmailAddresses() |
| 39 | +
|
| 40 | +Response: |
| 41 | +array:5 [ |
| 42 | + 0 => Email {#227 ▼ |
| 43 | + +user: "sddfsfsfd" |
| 44 | + +domain: "phototime.com.sa" |
| 45 | + |
| 46 | + +_diskused: 0 |
| 47 | + +_diskquota: 0 |
| 48 | + +humandiskused: "None" |
| 49 | + +humandiskquota: "None" |
| 50 | + +suspended_incoming: 0 |
| 51 | + +suspended_login: 0 |
| 52 | + +mtime: 1539715896 |
| 53 | + } |
| 54 | + ] |
| 55 | +``` |
| 56 | +Create a new email account |
| 57 | +```php |
| 58 | +$cpanel->create('username','password') |
| 59 | + |
| 60 | +Response: |
| 61 | +[ |
| 62 | + "status" => "success" |
| 63 | + "message" => "Email address has been added successfully" |
| 64 | +] |
| 65 | +``` |
| 66 | +Create a new email account |
| 67 | +```php |
| 68 | +$cpanel->delete('email_address') |
| 69 | + |
| 70 | +Response: |
| 71 | +[ |
| 72 | + "status" => "success" |
| 73 | + "message" => "Email address has been deleted successfully" |
| 74 | +] |
| 75 | +``` |
| 76 | + |
| 77 | +## Support: |
| 78 | + |
| 79 | + |
| 80 | +https://www.linkedin.com/in/naif |
| 81 | + |
| 82 | +## License |
| 83 | +The MIT License (MIT). Please see [License File](LICENSE.md) for more information. |
| 84 | + |
0 commit comments