Download the PHP package crucialdigital/metamorph without Composer

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

Crucial Digital Metamorph

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

Metamorph is a Laravel package that implements a data model system based on mongodb. This package provides a powerful system for managing dynamically models for api development.

Before going any further, consider that this package is intended for API development with Laravel and Mongodb

Table of contents

Installation

You can install the package via composer:

You must now publish the config file with:

Usage

Creating Model Repository and data model

Create your data model files with artisan command:

This command will create three files:

Is Laravel Eloquent model extends from CrucialDigital\Metamorph\BaseModel.php class. You are free to create your model with Laravel syntax and extends CrucialDigital\Metamorph\BaseModel.php. Consider implement label() and search() method responsible respectively for labeling form resource and define field on witch query with default search term

Is the repository class responsible for creating the model query builder. You can also create repositories with artisan command

The json file describes the form that handles the model with all its inputs. The json file structure looks like:

where required fields are entity and inputs.

Each entry of inputs must have at least:

* field: The input field
* name: The label of the input
* type: The input type in list below
    * text
    * number
    * tel
    * email
    * date
    * datetime
    * radio
    * boolean
    * select
    * textarea
    * url
    * selectresource
    * resource
    * geopoint

For input of type select, options is required and is an array of object with label and value

For input of type selectresource and resource, entity filed is required. The entity must be unique for the model around your application

Other field are :

You are free to add any other field to the input that you can use in your frontend application

Configure data model into metamorph config file

To configure how metamorph maps model with repository, data model form, controller and routes, you have to indicate in metamorph config file in models and repositories sections respectively the Eloquent model and model repository.

Example :

Run your data models

After creating your data models in .json files, you have to persist into your database with artisan command.

This artisan command persists data models into the database. Every time you modify .json file in database\models, update data with this command. You can specify the name of the .json file with --name parameter

Consider configuring the mongodb database connection before.

Make API requests

Metamorph provides various endpoint de Create, Read, Update en Delete. Available endpoint are :

Methods Endpoints Description Parameters
POST api/metamorph/exports/{entity}/{form} Export data with selected form entity: mapped model entity
form: selected data form
GET, HEAD api/metamorph/form-data
POST api/metamorph/form-data
GET,HEAD api/metamorph/form-data/{form_datum}
PUT,PATCH api/metamorph/form-data/{form_datum}
DELETE api/metamorph/form-data/{form_datum}
POST api/metamorph/form-inputs
GET,HEAD api/metamorph/form-inputs/{form_input}
PUT,PATCH api/metamorph/form-inputs/{form_input}
DELETE api/metamorph/form-inputs/{form_input}
POST api/metamorph/form/{entity}
GET,HEAD api/metamorph/forms
POST api/metamorph/forms
GET,HEAD api/metamorph/forms/{form}
PUT,PATCH api/metamorph/forms/{form}
DELETE api/metamorph/forms/{form}
POST api/metamorph/many/search
POST api/metamorph/master/{entity} Create model entry entity: mapped model entity
GET,HEAD api/metamorph/master/{entity}/{id} Get model entry entity: mapped model entity
id: model entity id
PUT,PATCH api/metamorph/master/{entity}/{id} Update model entry entity: mapped model entity
id: model entity id
DELETE api/metamorph/master/{entity}/{id} Delete model entry entity: mapped model entity
id: model entity id
PATCH api/metamorph/reject/form-data/{id}
POST api/metamorph/resources/entities
POST api/metamorph/resources/entity/
POST api/metamorph/search/{entity} Lists models entries See table below
POST api/metamorph/validate/form-data/{id}


Model entry list request parameters


Parameter Description Parameter type Value type Default value
entity mapped model entity string url part param
term search term form route search string query param
paginate whether paginate request or not i.e: 0,1 string, int query param 1
per_page number of element per page _default int query param 15
order_by order field string query param _createdat
order_direction order direction of order_by i.e : ASC, DESC string query param ASC
randomize whether result is randomize Incompatible with paginate int, string query param 0
with_trash whether result is with trashed entries int, string query param 0
only_trash whether result is only trashed entries int, string query param 0
filters filter criteria for the request
i.e:
Available operator:
=, !=, <, >, date, datebefore, dateafter, dateaftereq, datebeforeq, datenot, datebetween, datenotbetween, like, in, notin, between, notbetween, all, exists, elemMatch, size, regexp, type, mod, near, geoWithin, geoIntersects
See Mongodb query and projection operators documentation for more operator
object[ ] query param [ ]
search Same as filters object[ ] query param [ ]

NOTE
field : value of filters can be nested relation field i.e: comments.user._id
coordinator : one of and, or to indicate using where(...) / orWhere(...)
group : is used to group filter criteria into sub-query; the value must start with one of and_ or_

Advanced

Global Middleware

To define global middleware for all metamorph routes, in metamorph config file, config/metamorph.php fill the middlewares array with your middlewares

If you are using Laravel Sanctum for authentification, don't forget to add the middleware auth:sanctum to avoid trouble with Metamorph authorisation system

Model Middleware

Beyond global middleware you can't define individual middleware for every model route and for each controller action in metamorph config file, config/metamorph.php fill the model_middlewares array with your middlewares

Policies

To authorize model controller action with police authorization, in metamorph config file, config/metamorph.php fill the policies array with the policy actions associate with your models

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.


All versions of metamorph with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1|8.2
illuminate/contracts Version ^10|^11
illuminate/support Version ^10|^11
intervention/image Version ^2.7
maatwebsite/excel Version ^3.1
mongodb/laravel-mongodb Version ^4.6
psr/simple-cache Version ^2.0|^3.0
spatie/laravel-package-tools Version ^1.13.0
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 crucialdigital/metamorph contains the following files

Loading the files please wait ....