PHPackages                             amin3520/anar - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. amin3520/anar

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

amin3520/anar
=============

:description

v1.1.9(2y ago)272.3k7[3 issues](https://github.com/amin3536/Anar/issues)[5 PRs](https://github.com/amin3536/Anar/pulls)MITPHP

Since Dec 28Pushed 2y ago3 watchersCompare

[ Source](https://github.com/amin3536/Anar)[ Packagist](https://packagist.org/packages/amin3520/anar)[ Docs](https://github.com/amin3520/anar)[ RSS](/packages/amin3520-anar/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (9)Dependencies (5)Versions (20)Used By (0)

Anar
====

[](#anar)

[![Latest Version on Packagist](https://camo.githubusercontent.com/17d0d1b1b5b794fde674d43bd9954b3fa863b4c2e8c3af441e2d49ed8ee3f524/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f616d696e333532302f616e61722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/amin3520/anar)[![Total Downloads](https://camo.githubusercontent.com/9828ebbd58d77b154f963a4de312c942f3450034e0560fc8a65f3f3d7490fa66/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f616d696e333532302f616e61722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/amin3520/anar)[![Build Status](https://camo.githubusercontent.com/cdc7ecf26244c32c1eb8a4f01ce6d0b0a871d904ddda2068e18311bca6dca9c1/68747470733a2f2f7472617669732d63692e6f72672f616d696e333533362f416e61722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/amin3536/Anar)[![StyleCI](https://camo.githubusercontent.com/96b8abfe78c3d9496cb13f77f5d5179c8fe71329f5f34c82fffbc46f386ed91f/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3136333231303233302f736869656c643f6272616e63683d6d6173746572)](https://github.styleci.io/repos/163210230)

Anar is artisan command to create repository for your amazing laravel app easy peasy . Take look at [contributing.md](contributing.md) to see a to do list.

if you don't know about Repository pattern read [this link](https://medium.com/employbl/use-the-repository-design-pattern-in-a-laravel-application-13f0b46a3dce)

Installation
------------

[](#installation)

Via Composer

```
$ composer require amin3520/anar
```

Change log
----------

[](#change-log)

Please see the [changelog](changelog.md) for more information on what has changed recently.

command
-------

[](#command)

```
$ php artisan make:repository name  --m=model_name --imp
  #sample php artisan make:repository UserRepository --m=User --imp
  #sample2 php artisan make:repository UserRepository --m='\App\User' --imp
```

` name` is your name Repository ,

` --m`option is model name that use in repo and it is necessary input , now u can also pass your address model in string like '\\App\\User'

` --imp` create interface for your repo

first run of command create base files and directory ,you can see them below

```
|--Providers
|       |--RepositoryServiceProvider.php
|
|--Repositories
|       |--BaseRepository.php
|       |--BaseRepositoryImp.php
|       |//and other your repoitorys
```

### *Configuration*

[](#configuration)

if you want inject your repositories in some constructor like controllers ,add repo name in `$names` in `Providers/RepositoryServiceProvider.php`and add `\App\Providers\RepositoryServiceProvider::class` in `providers` in `config\app.php`

```
  /**
     * Register RepositoryServiceProvider  .
     * provide your repository and inject it any where below your app directoy, like in to your controller's app if you want to use it
     * @return void
     */
    public function register()
    {
         $names = [
               //add Begin your repository name here   like -> 'UserRepository',
            ];

            foreach ($names as $name) {
                $this->app->bind(
                    "App\\Repositories\\{$name}",
                    "App\\Repositories\\{$name}");
            }

    }
```

### *Usage*

[](#usage)

```
class Controller extends BaseController
{
    use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
    private $userRepo;

    /**
     * Controller constructor.
     *inject repo by service provider
     */
    public function __construct(UserRepositoryImp $repositoryImp)
    {
        $this->userRepo=$repositoryImp;
        //now u can use it
    }

    public function updateName(Request $request)
    {
        $this->userRepo->update(['name'=>'amin'],auth::id());
    }
}
```

*BaseMethods*
-------------

[](#basemethods)

Base repository has some useful method you can use theme

```
interface BaseRepositoryImp
{
        public function create(array $attributes);
        public function update(array $attributes, int $id);
        public function all($columns = array('*'), string $orderBy = 'id', string $sortBy = 'desc');
        public function find(int $id);
        public function findOneOrFail(int $id);
        public function findBy(array $data);
        public function findOneBy(array $data);
        public function findOneByOrFail(array $data);
        public function paginateArrayResults(array $data, int $perPage = 50);
        public function delete(int $id);
        public function findWhere($where, $columns = ['*'], $or = false);
        public function with(array $relations);
}
```

[![methods](https://camo.githubusercontent.com/f3aca376b1d7bca347c022b1fdcef178ffbd622b129005182b7e2e1a620a85b5/687474703a2f2f73392e7069636f66696c652e636f6d2f66696c652f383334373034353231382f6578706c61696e5f312e6a7067)](https://camo.githubusercontent.com/f3aca376b1d7bca347c022b1fdcef178ffbd622b129005182b7e2e1a620a85b5/687474703a2f2f73392e7069636f66696c652e636f6d2f66696c652f383334373034353231382f6578706c61696e5f312e6a7067)

Contributing
------------

[](#contributing)

Please see [contributing.md](contributing.md) for details and a todolist.

Task list:
----------

[](#task-list)

- add Test
- add dynamic directory option
- add dynamically pickUp address's model
- add cache option

License
-------

[](#license)

MIT License. Please see the [license file](license.md) for more information.

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity28

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity69

Established project with proven stability

 Bus Factor1

Top contributor holds 88.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~134 days

Recently: every ~204 days

Total

13

Last Release

1079d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/fdc77a1bfd52aa8346afc0bde4143fbee5b9cffe013adaa1b5f4a50ed04470f1?d=identicon)[amin3520](/maintainers/amin3520)

---

Top Contributors

[![amin3536](https://avatars.githubusercontent.com/u/20286200?v=4)](https://github.com/amin3536 "amin3536 (102 commits)")[![freakpants](https://avatars.githubusercontent.com/u/12885929?v=4)](https://github.com/freakpants "freakpants (6 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (5 commits)")[![reyhane1376](https://avatars.githubusercontent.com/u/97376622?v=4)](https://github.com/reyhane1376 "reyhane1376 (1 commits)")[![StyleCIBot](https://avatars.githubusercontent.com/u/11048387?v=4)](https://github.com/StyleCIBot "StyleCIBot (1 commits)")

---

Tags

artisan-commandlaravelrepositorylaravelrepositoryAnar

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/amin3520-anar/health.svg)

```
[![Health](https://phpackages.com/badges/amin3520-anar/health.svg)](https://phpackages.com/packages/amin3520-anar)
```

###  Alternatives

[cybercog/laravel-paket

Composer personal web interface. Manage Laravel dependencies without switching to command line!

1753.3k](/packages/cybercog-laravel-paket)[interaction-design-foundation/laravel-geoip

Support for multiple Geographical Location services.

17221.0k3](/packages/interaction-design-foundation-laravel-geoip)[mckenziearts/laravel-command

A simple Laravel package to provide artisan new commands

321.2k](/packages/mckenziearts-laravel-command)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
