Download the PHP package imanghafoori/eloquent-relativity without Composer

On this page you can find all versions of the php package imanghafoori/eloquent-relativity. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package eloquent-relativity

Eloquent Relativity

This allows you to decouple your eloquent models from one another, by defining relations dynamically at run-time.

- Note that this package is NOT needed in laravel 7.x or above.

Read more: https://laravel.com/docs/7.x/eloquent-relationships#dynamic-relationships

widgetize_header

Build Status Scrutinizer Code Quality Code Coverage Latest Stable Version StyleCI Total Downloads

Compatibility :

Laravel version 5.5 and above including version 6

:arrow_forward: A problem which stops true modularity :

Let's face it, imagine you have a modular blog application.

Then, you want to add a commenting feature to it, so that users can comment on your articles.

In a modular structure, you have 2 modules (user module and blog module) and you will add a new module for comments

:arrow_forward: let's analyze dependencies and couplings :

Here the blog module "knows" and "depends" upon the user module.

But the user module should not know or care about the blog module. The blog is a plug-in on the top of the user module.

Now we want to add a comment module, on the top of user and blog module.

:arrow_forward: The Right way :

In a truely modular system when you add the comments, you should NOT go and touch the code within the users or blog module. (Remember the open-closed principle in SOLID ?!)

Imagine you are in a team and each member is working on a seperate module.

Blog module is not yours. your team mate is responsible for it and is allowed to code on it.

But when you want to start to define the eloquent relations between Comment and User and Article models, you immediately realize that you have to put code on the eloquent models of other modules to define the inverse of the relationships. Crap !

Look How everything is pointing inward.

If you look at the User folder you will have absolutely no footprint of Comment or Article.

We have to touch the code of both Blog and User module when add a new comment module.

For example : You have to open User.php and define the

and this is a no no, because it makes an arrow from inside to outside.

So what to do ?!

How can Comment be introduced to the system without modifying the other modules ?! (@_@)

:arrow_forward: Install: (the most painful step)

Now the installtion finished, you first have to make your models "relative" !!!

By using the Imanghafoori\Relativity\DynamicRelations traits on your eloquent models.

image

So the User, Article, Comment will have to have this trait one them.

Now comes the sweet part :

within the CommentsServiceProvider.php

Now you can do these queries :

So instead of going to User model and define a method there...

You have defined the method remotely from your new module at run-time:

Here is a list of supported relations :

They accept the same paramters as the eloquent equivalent counter part. except the first argument should be relation name.

:arrow_forward: Extra features :

sometimes you need to call extra methods on the relations.

All the methods are available to you.

On reqular eloquent models you may define the

instead you can :

remember this should be in the boot method of your Service Provider not the register method.

:star: Your Stars Make Us Do More :star:

As always if you found this package useful and you want to encourage us to maintain and work on it, Please press the star button to declare your willing.

:arrow_forward: More from the author:

Laravel Terminator

:gem: A minimal yet powerful package to give you opportunity to refactor your controllers.


Laravel Widgetize

:gem: A minimal yet powerful package to give a better structure and caching opportunity for your laravel apps.


Laravel Master Pass

:gem: A simple package that lets you easily impersonate your users.


Laravel HeyMan

:gem: It allows to write exressive and defensive code which is decoupled from the rest of your app.


🍌 Reward me a banana 🍌

so that I will have energy to start the next package for you.

Dodge Coin: DJEZr6GJ4Vx37LGF3zSng711AFZzmJTouN

LiteCoin: ltc1q82gnjkend684c5hvprg95fnja0ktjdfrhcu4c4

BitCoin: bc1q53dys3jkv0h4vhl88yqhqzyujvk35x8wad7uf9

Ripple: rJwrb2v1TR6rAHRWwcYvNZxjDN2bYpYXhZ

Etherium: 0xa4898246820bbC8f677A97C2B73e6DBB9510151e


Life is like riding a bicycle. To keep your balance you must keep moving. "Albert Einstein"


All versions of eloquent-relativity with dependencies

PHP Build Version
Package Version
Requires php Version ^7.1.3|7.2.*|7.3.*|7.4.*|8.0.*|8.1.*|8.2.*|8.3.*
laravel/framework Version ~5.1|6.*|7.*|8.*|9.*|10.*|11.*
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package imanghafoori/eloquent-relativity contains the following files

Loading the files please wait ....