-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 37e209f
Showing
37 changed files
with
11,226 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
insert_final_newline = true | ||
indent_style = space | ||
indent_size = 4 | ||
trim_trailing_whitespace = true | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false | ||
|
||
[*.yml] | ||
indent_size = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
* text=auto eol=lf | ||
/.github export-ignore | ||
.scrutinizer.yml export-ignore | ||
BACKERS.md export-ignore | ||
CONTRIBUTING.md export-ignore | ||
CHANGELOG.md export-ignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/vendor | ||
/.idea | ||
/.vscode | ||
/.vagrant | ||
.phpunit.result.cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<a href="https://supportukrainenow.org/"><img src="https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/banner-direct.svg" width="100%"></a> | ||
|
||
------ | ||
|
||
<p align="center"> | ||
<img title="Laravel Zero" height="100" src="https://raw.githubusercontent.com/laravel-zero/docs/master/images/logo/laravel-zero-readme.png" /> | ||
</p> | ||
|
||
<p align="center"> | ||
<a href="https://github.com/laravel-zero/framework/actions"><img src="https://github.com/laravel-zero/laravel-zero/actions/workflows/tests.yml/badge.svg" alt="Build Status"></img></a> | ||
<a href="https://packagist.org/packages/laravel-zero/framework"><img src="https://img.shields.io/packagist/dt/laravel-zero/framework.svg" alt="Total Downloads"></a> | ||
<a href="https://packagist.org/packages/laravel-zero/framework"><img src="https://img.shields.io/packagist/v/laravel-zero/framework.svg?label=stable" alt="Latest Stable Version"></a> | ||
<a href="https://packagist.org/packages/laravel-zero/framework"><img src="https://img.shields.io/packagist/l/laravel-zero/framework.svg" alt="License"></a> | ||
</p> | ||
|
||
<h4> <center>This is a <bold>community project</bold> and not an official Laravel one </center></h4> | ||
|
||
Laravel Zero was created by [Nuno Maduro](https://github.com/nunomaduro) and [Owen Voke](https://github.com/owenvoke), and is a micro-framework that provides an elegant starting point for your console application. It is an **unofficial** and customized version of Laravel optimized for building command-line applications. | ||
|
||
- Built on top of the [Laravel](https://laravel.com) components. | ||
- Optional installation of Laravel [Eloquent](https://laravel-zero.com/docs/database/), Laravel [Logging](https://laravel-zero.com/docs/logging/) and many others. | ||
- Supports interactive [menus](https://laravel-zero.com/docs/build-interactive-menus/) and [desktop notifications](https://laravel-zero.com/docs/send-desktop-notifications/) on Linux, Windows & MacOS. | ||
- Ships with a [Scheduler](https://laravel-zero.com/docs/task-scheduling/) and a [Standalone Compiler](https://laravel-zero.com/docs/build-a-standalone-application/). | ||
- Integration with [Collision](https://github.com/nunomaduro/collision) - Beautiful error reporting | ||
|
||
------ | ||
|
||
## Documentation | ||
|
||
For full documentation, visit [laravel-zero.com](https://laravel-zero.com/). | ||
|
||
## Support the development | ||
**Do you like this project? Support it by donating** | ||
|
||
- PayPal: [Donate](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=66BYDWAT92N6L) | ||
- Patreon: [Donate](https://www.patreon.com/nunomaduro) | ||
|
||
## License | ||
|
||
Laravel Zero is an open-source software licensed under the MIT license. |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Commands; | ||
|
||
use LaravelZero\Framework\Commands\Command; | ||
|
||
use function Laravel\Prompts\select; | ||
|
||
class AddAccount extends Command | ||
{ | ||
protected $signature = 'account:add'; | ||
|
||
protected $description = 'Command description'; | ||
|
||
public function handle() | ||
{ | ||
$providers = collect(config('dns.providers')); | ||
|
||
$providerName = select( | ||
label: 'Which DNS provider do you want to add?', | ||
options: $providers->map(fn ($provider) => $provider::getName()), | ||
); | ||
|
||
$provider = $providers->first(fn ($provider) => $provider::getName() === $providerName); | ||
|
||
app($provider)->setUpNewCredentials(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Commands; | ||
|
||
use App\Data\Record; | ||
use App\Enums\RecordType; | ||
use App\Support\Config; | ||
use App\Support\SelectsADomain; | ||
use LaravelZero\Framework\Commands\Command; | ||
|
||
use function App\Validation\rules; | ||
use function Laravel\Prompts\error; | ||
use function Laravel\Prompts\select; | ||
use function Laravel\Prompts\text; | ||
|
||
class AddRecord extends Command | ||
{ | ||
use SelectsADomain; | ||
|
||
protected $signature = 'records:add'; | ||
|
||
protected $description = 'Command description'; | ||
|
||
public function handle(Config $config) | ||
{ | ||
$provider = $this->selectDomain($config); | ||
|
||
$recordType = select( | ||
label: 'Record Type', | ||
options: collect(RecordType::cases())->pluck('value'), | ||
); | ||
|
||
$name = text( | ||
label: 'Name', | ||
required: true, | ||
// TODO: This hint is probably more for just A records? | ||
hint: 'The host name, alias, or service being defined by the record. @ for the root domain.', | ||
); | ||
|
||
$value = text( | ||
label: 'Value', | ||
required: true, | ||
); | ||
|
||
$ttl = text( | ||
label: 'TTL', | ||
hint: 'The time to live for the record, in seconds.', | ||
required: true, | ||
default: '3600', | ||
validate: rules( | ||
['integer', 'min:0'], | ||
'TTL', | ||
[ | ||
'integer' => 'TTL must be an integer.', | ||
'min' => 'TTL must be greater than 0.', | ||
], | ||
), | ||
); | ||
|
||
$result = $provider->addRecord( | ||
new Record( | ||
type: RecordType::from($recordType), | ||
name: $name, | ||
value: $value, | ||
ttl: (int) $ttl, | ||
), | ||
); | ||
|
||
if ($result) { | ||
info('Record added successfully.'); | ||
} else { | ||
error('There was an error adding the record.'); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Commands; | ||
|
||
use App\Data\Record; | ||
use App\Support\Config; | ||
use App\Support\SelectsADomain; | ||
use LaravelZero\Framework\Commands\Command; | ||
|
||
use function Laravel\Prompts\info; | ||
use function Laravel\Prompts\table; | ||
|
||
class ListRecords extends Command | ||
{ | ||
use SelectsADomain; | ||
|
||
protected $signature = 'records:list'; | ||
|
||
protected $description = 'Command description'; | ||
|
||
public function handle(Config $config) | ||
{ | ||
$provider = $this->selectDomain($config); | ||
|
||
$records = $provider->listRecords()->map(fn (Record $record) => [ | ||
$record->type->value, | ||
$record->name, | ||
wordwrap( | ||
string: $record->value, | ||
width: 45, | ||
cut_long_words: true, | ||
), | ||
$record->ttl, | ||
$record->priority, | ||
$record->comment, | ||
]); | ||
|
||
if ($records->isEmpty()) { | ||
info('No records found.'); | ||
|
||
return; | ||
} | ||
|
||
table( | ||
['Type', 'Name', 'Value', 'TTL', 'Priority', 'Comment'], | ||
$records, | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Commands; | ||
|
||
use App\Support\Config; | ||
use App\Support\SelectsADomain; | ||
use App\Support\SelectsAnAccount; | ||
use LaravelZero\Framework\Commands\Command; | ||
|
||
use function Laravel\Prompts\info; | ||
use function Laravel\Prompts\intro; | ||
use function Laravel\Prompts\outro; | ||
use function Laravel\Prompts\spin; | ||
|
||
class UpdateNameservers extends Command | ||
{ | ||
use SelectsADomain, SelectsAnAccount; | ||
|
||
protected $signature = 'nameservers:update'; | ||
|
||
protected $description = 'Command description'; | ||
|
||
public function handle(Config $config) | ||
{ | ||
intro('Update Nameservers'); | ||
|
||
info('Select the domain you want to update the nameservers for.'); | ||
$fromProvider = $this->selectDomain($config); | ||
|
||
info('Select the account you want to update the nameservers to.'); | ||
$toProvider = $this->selectAccount($config); | ||
|
||
spin(function () use ($fromProvider, $toProvider) { | ||
$toProvider->setDomain($fromProvider->getDomain())->addDomain(); | ||
$fromProvider->updateNameservers($toProvider->getNameservers()); | ||
}, 'Updating nameservers...'); | ||
|
||
$this->output->write("\e[1A"); // Move the cursor up one, spinner leaves an extra line | ||
|
||
outro('Nameservers updated!'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Data; | ||
|
||
use App\Enums\RecordType; | ||
use Spatie\LaravelData\Data; | ||
|
||
class Record extends Data | ||
{ | ||
public function __construct( | ||
public RecordType $type, | ||
public string $name, | ||
public string $value, | ||
public int $ttl, | ||
public ?int $priority = null, | ||
public ?string $tag = null, | ||
public ?int $weight = null, | ||
public ?int $port = null, | ||
public ?int $flags = null, | ||
public ?string $comment = null, | ||
) { | ||
} | ||
} |
Oops, something went wrong.