Download the PHP package marqant-lab/laravel-medialibrary-graphql without Composer

On this page you can find all versions of the php package marqant-lab/laravel-medialibrary-graphql. 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 laravel-medialibrary-graphql

Laravel Medialibrary GraphQL

This package contains GraphQL queries and mutations to manage any type of media files and make them attacheable to any given model.

About

We use Lighthouse for GraphQL.

The management of the mediafiles is based on the spatie/laravel-medialibrary package.

By default this package uses Model from config auth.providers.users.model for assign files.
But you can change this after publish package config and change 'laravel-medialibrary-graphql.models.default' value.

Installation

Require the package through composer.

You will have to run the migrations to setup the media table.

Publish the configuration.

In this config you can specify a model to assign files to ('models.default') and many other settings. The model should implements Spatie\MediaLibrary\HasMedia interface and use Spatie\MediaLibrary\InteractsWithMedia trait.

For example User model:

Also you can add as many models as you need.
Example of config:

But in this case you need to send 'model' param for getMedia() query and uploadFile() and deleteAllMedia() mutations.
If 'model' param is empty (null) then 'models.default' model will be taken to attach files.

If you need Spatie\MediaLibrary config:

If you plan to use the web route 'media/download/' to download files, add the MEDIA_API_KEY variable to your .env file to secure your application's downloads with an api key.

You need to set this key as 'apiKey' at headers.

This package uses it's own @guardMedia directive for secure.
By default 'guard' in config is 'sanctum' but you can change it after publish package's config file.
You can setup our marqant-lab/auth-graphql package for auth and follow all instructions of the package.

After this add import to your schema.graphql

Queries

Query Requires input Returns
getMedia id: Int! (ID of the model need to delete all files from), [Media]
model: String (model key from config, if null 'default'
model will be taken)
downloadMedia uuid: String! String!

Mutations

Mutation Requires input Returns
uploadFile id: Int! (ID of the model need to attach file to), [Media]
file: Upload!,
model: String (model key from config,
if null 'default' model will be taken),
name: String, properties: Json
deleteMedia uuid: String! String
deleteAllMedia id: Int! (ID of the model need to delete all files from), String
model: String (model key from config,
if null 'default' model will be taken),

uploadFile mutation example:

plus 'file' type Upload (models)

response example:

Tests

If you want to execute package tests add this to the phpunit.xml

And after you can check it by executing:


All versions of laravel-medialibrary-graphql with dependencies

PHP Build Version
Package Version
Requires laravel/framework Version ^7.0
nuwave/lighthouse Version ^4.16
spatie/laravel-medialibrary Version ^8.0.0
marqant-lab/lighthouse-json Version ^0.0.2
marqant-lab/auth-graphql Version ^0.0.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 marqant-lab/laravel-medialibrary-graphql contains the following files

Loading the files please wait ....