PHP code example of guillermoandrae / php-repository

1. Go to this page and download the library: Download guillermoandrae/php-repository 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/ */

    

guillermoandrae / php-repository example snippets


RepositoryFactory::setNamespace('MyStuff\Repositories');

namespace App\Repositories; // again, use whatever you like

use Guillermoandrae\Repositories\AbstractRepository;

class WidgetsRepository extends AbstractRepository
{
    public function create(array $data): ModelInterface
    {
        // add your object creation code here
    }
}

namespace App\Repositories;

use Guillermoandrae\Models\AbstractModel;

final class WidgetModel extends AbstractModel // the "final" is optional
{
    // add your constructor and getters
}

composer