PHP code example of artisan-build / built-for-cloud
1. Go to this page and download the library: Download artisan-build/built-for-cloud 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/ */
Route::middleware('bfc.auth')->group(function () {
// signed-in users
});
Route::middleware('bfc.admin')->group(function () {
// Owner and Admin only
});
use ArtisanBuild\BuiltForCloud\Commands\Concerns\WritesInstallEnv;
use Illuminate\Console\Command;
final class SinkInstallCommand extends Command
{
use WritesInstallEnv;
protected $signature = 'sink:install {--api-url=}';
public function handle(): int
{
$apiUrl = $this->option('api-url') ?: text('Sink API URL');
$envChanged = $this->writeEnvFile($this->laravel->environmentFilePath(), [
'SINK_API_URL' => $apiUrl,
]);
$this->pinComposerConstraint(base_path('composer.json'), 'artisan-build/sink', 1);
$this->summarize([
'env changed' => $envChanged,
'composer package' => 'artisan-build/sink:^1',
]);
return self::SUCCESS;
}
}
use ArtisanBuild\BuiltForCloud\Testing\ContractAssertions;
use Illuminate\Foundation\Testing\RefreshDatabase;
uses(RefreshDatabase::class);
uses(ContractAssertions::class);
it('satisfies the Built for Cloud contract', function (): void {
$this->assertBuiltForCloudContract();
});