1. Go to this page and download the library: Download musamba/red-thread 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/ */
musamba / red-thread example snippets
use Musamba\RedThread\Traits\HasRedThreads;
use Musamba\RedThread\Attributes\RedThread;
class Book extends Model
{
use HasRedThreads;
// ...
#[RedThread]
public function reviews(): HasMany
{
return $this->hasMany(Review::class);
}
#[RedThread]
public function author(): BelongsTo
{
return $this->belongsTo(Author::class);
}
// ...
}
use Musamba\RedThread\Traits\HasRedThreads;
class Book extends Model
{
use HasRedThreads;
// ...
public function reviews(): HasMany
{
return $this->hasMany(Review::class);
}
public function author(): BelongsTo
{
return $this->belongsTo(Author::class);
}
// ...
}