Download the PHP package scrnhq/laravel-bakery without Composer

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

Build Status status Latest Version Code Quality Total Downloads License


An on-the-fly GraphQL Schema generator from Eloquent models for Laravel.

Installation

This package requires PHP 7.2 and Laravel 6 or higher. To get started with Bakery, simply run:

Quickstart

After installing Bakery, publish the configuration and asserts using the bakery:install Artisan command.

After running this command, the configuration file should be located at config/bakery.php. The default App\Bakery\User Bakery model schema refers to the App\User model.

You can find your new GraphQL API at /graphql and you can navigate to /graphql/explore to find GraphiQL, the graphical interactive GraphQL IDE.

Model schemas

Model schemas are classes that lets you connect your Eloquent models with the GraphQL API. In there you can define which fields are available, which of them can be mutated and much more.

By default, Bakery model schema's are stored in the app\Bakery directory. You can generate a new model schema using the handy bakery:modelschema Artisan command.

The model property of a model schema defines which Eloquent model it corresponds to.

Registering model schemas

All model schema's in the app/Bakery directory will automatically be registered by Bakery. If you choose to store your model schema's differently, you need to define and register your schema manually.

You are not required to manually define and register a Schema. You can skip this step if you do not wish to manually register a schema.

In order to make model schemas available within GraphQL, they must be registered in a Schema. First you must create a new Schema class. Next, you should set the schema item in the config/bakery.php file to the newly created Schema.

There are two ways to manually registering model schemas in Bakery. You can use the modelsIn method in the schema to load all models schemas in a given directory, or you can manually return an array of models schemas.

Now that you have created and registered your model schemas with Bakery, you can browse to /graphql/explore and query your models in the interactive playground GraphQL.

If everything is set up properly you will get a collection of posts in your database. You can also use GraphQL to retrieve a single post.

Just like Laravel, Bakery follows naming conventions. It uses Laravel's pluralization library to transform your model into queries so you can fetch an individual Post with post and a collection of Posts with posts.

Fields

Now, each Bakery model schema contains a fields that return an array of fields, which extend the \Bakery\Fields\Field class. To add a field to model schema, simply add it to fields method, where the key of the item must match the name of the model attribute.

Now you can query the title of the posts in GraphQL.

Field Types

Bakery has the following fields available:

Boolean
Float
ID
Int
String

Relations

In addition to the fields described above, Bakery supports Eloquent relationships, too. To add a relationship to the model schema, simply add it to the relations method, where the key of the item must match the relation name. Let's say a User model hasMany Post models. Then you would define your Bakery model schema's like so:

app\Bakery\User.php

The inverse of the previous relation is that a Post model belongsTo a User model. The Bakery model schema would be defined like so:

app\Bakery\Post.php

This way you can get all posts related to a user within a single GraphQL query.

Mutations

Another key feature of GraphQL that Bakery fully supports are mutations. Bakery automatically creates the create, update, and delete mutations for each registered model. Bakery also seamlessly uses Laravel's policies to authorize the actions of your users.

Having policies for your models is required for Bakery mutations to work. See https://laravel.com/docs/5.7/authorization for more information.

For example, with the model schemas mentioned above, you could create a Post with a simple GraphQL mutation.


All versions of laravel-bakery with dependencies

PHP Build Version
Package Version
Requires php Version ^7.2|^8.0
ext-json Version *
illuminate/support Version ^6.0|^7.0|^8.0
webonyx/graphql-php Version ^0.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 scrnhq/laravel-bakery contains the following files

Loading the files please wait ....