定制 ssmalik99/repostarry 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

ssmalik99/repostarry

最新稳定版本:V1.0.2

Composer 安装命令:

composer require ssmalik99/repostarry

包简介

This is a helper package to create Repository system usage easy for laravel users

README 文档

README

Starry is a small package for creating a standard repository system in Laravel(PHP Framework).

Installation

Install via composer

composer require ssmalik99/repostarry

Usage

Launch Starry

php artisan starry:launch

This command will launch a basic setup for the starry and publish a config file starry.php to manage configuration of starry package.

Change configuration

If you want to use other folder structure then you can change this by changing the .env variables

If we followed the default setup then this config file will appear
<?php

return [

    /*
    * ***************************************
    * Which data model our project is using *
    * ***************************************
    */
    "starry_data_model" => env('STARRY_DATA_MODEL', "Eloquent"),

    /*
    * ********************************************
    * Path where we want to store out interfaces *
    * ********************************************
    */
    'starry_interfaces_path' => env("STARRY_INTERFACES_PATH", "StarryInterfaces"),

    /*
    * ********************************************
    * Where We want to store our main repository *
    * ********************************************
    */
    "starry_repository_path" => env("STARRY_REPOSITORY_PATH", "Eloquent"),

    'bindings' => [
		\App\Repository\StarryInterfaces\EloquentRepositoryInterface::class => \App\Repository\Eloquent\BaseRepository::class,

	],
];

Initially Starry will follow this structure according to the above configuration.

---App
------Repository
----------------Eloquent(Default Setup)
---------------------------------------BaseRepository.php
----------------StarryInterfaces(Default Setup)
----------------------------------------------EloquentRepositoryInterface.php(Default Setup)

All repositories other than the default one will extend the BaseRepository just to reduce the code.

Create your Starry

php artisan make:starry model_name

This command required a model_name for which you want to create repository and interface

For Instance

php artisan make:starry User

This will create UserRepositoryInterface, UserRepository and bind them to our laravel app.

Binding

How binding actually work for starry?

In starry.php inside our config folder we have our all bindings.

    'bindings' => [
      \App\Repository\StarryInterfaces\EloquentRepositoryInterface::class => \App\Repository\Eloquent\BaseRepository::class,

    ],

So if you have created your Repository manually and you want to bind this with the help of starry, simply add your interface as the key and repository_class as value for the element in bindings array

License

MIT

统计信息

  • 总下载量: 19
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 5
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 4
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-07-07

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固