Download the PHP package kaveh/morph-service without Composer

On this page you can find all versions of the php package kaveh/morph-service. 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 morph-service

Laravel Morph Service 📦

Overview

The Laravel Morph Service package simplifies adding media files to multiple models without the need for separate media tables for each model. Instead, it provides a unified media table that associates files with different models dynamically.

This is achieved using mediable_id and mediable_type, which store the ID and type of the model that owns the media file. For example, if you want to store a profile picture for a User, the table will store the user_id as mediable_id and User as mediable_type. This structure makes it easy to retrieve media files related to specific models while maintaining a clean and structured database design.


🔧 Installation

To install the package, run the following command:

Then, add the provider in bootstrap/provider.php:

To ensure the package integrates properly with your project, add the following to composer.json:

Then, run:


📌 Database Migration

Run the migration command to set up the required tables:


📂 Usage

1️⃣ Define the Media Relationship

For any model that needs to support media files, add the following method:


2️⃣ Upload Media in Your Controller

To upload a file and associate it with a model, use the following:


🎯 Benefits

✔ Single media table for all models – No need for separate media tables.
✔ Flexible association – Easily attach media to different models dynamically.
✔ Efficient querying – Retrieve media files related to any model without extra joins.


This package streamlines media management in Laravel, making file storage more efficient and scalable! 🚀


All versions of morph-service with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
laravel/framework Version *
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 kaveh/morph-service contains the following files

Loading the files please wait ...