PHP code example of tripteki / laravelphp-repository
1. Go to this page and download the library: Download tripteki/laravelphp-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/ */
tripteki / laravelphp-repository example snippets
namespace App\Contracts\Repository;
use Tripteki\Repository\Contracts\Allable;
use Tripteki\Repository\Contracts\Getable;
use Tripteki\Repository\Contracts\Createable;
use Tripteki\Repository\Contracts\Updateable;
use Tripteki\Repository\Contracts\Deleteable;
interface IRepository extends Allable, Createable, Deleteable
{
//
};
namespace App\Repositories\QueryBuilder;
use App\Contracts\Repository\IRepository;
use Tripteki\Repository\AbstractRepository;
class MyRepository extends AbstractRepository implements IRepository
{
/**
* @param array $querystring
* @return mixed
*/
public function all($querystring = []) {}
/**
* @param array $data
* @return mixed
*/
public function create($data) {}
/**
* @param int|string $identifier
* @return mixed
*/
public function delete($identifier) {}
};
namespace App\Repositories\Eloquent;
use App\Contracts\Repository\IRepository;
use Tripteki\Repository\AbstractRepository;
class MyRepository extends AbstractRepository implements IRepository
{
/**
* @param array $querystring
* @return mixed
*/
public function all($querystring = []) {}
/**
* @param array $data
* @return mixed
*/
public function create($data) {}
/**
* @param int|string $identifier
* @return mixed
*/
public function delete($identifier) {}
};
namespace App\Providers;
use Tripteki\Repository\RepositoryServiceProvider as ServiceProvider;
class RepositoryServiceProvider extends ServiceProvider
{
/**
* @var array
*/
protected $repositories =
[
// For QueryBuilder //
\App\Contracts\Repository\IRepository::class => \App\Repositories\QueryBuilder\MyRepository::class,
// For Eloquent //
\App\Contracts\Repository\IRepository::class => \App\Repositories\Eloquent\MyRepository::class,
];
};
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.