laravel-restify

The fastest way to make a powerful JSON:API compatible Rest API with Laravel.

MIT License

Downloads
321.1K
Stars
600
Committers
20

Bot releases are visible (Hide)

laravel-restify - 4.8.0

Published by binaryk almost 4 years ago

Added

Fixes

  • JSON responses for the forgot and reset passwords.
laravel-restify - 4.7.0

Published by binaryk almost 4 years ago

Added

laravel-restify - 4.6.3

Published by binaryk almost 4 years ago

Added

  • Scaffolding UserRepository.
laravel-restify - 4.6.2

Published by binaryk almost 4 years ago

Added

  • Scaffolding UserRepository.
laravel-restify - 4.6.1

Published by binaryk almost 4 years ago

Added

  • Default scaffold for repository and base repository.
laravel-restify - 4.6.0

Published by binaryk almost 4 years ago

Added

  • Pivots on the show and index requests, they are now displayed in a pivots object.

Changed

  • Not for being able to attach / detach resources, you MUST have the ManyToMany field defined in the related of the repository.
laravel-restify - 4.5.4

Published by binaryk almost 4 years ago

Fixed

  • Fixed belongs to nullable relationship.
laravel-restify - 4.5.3

Published by binaryk almost 4 years ago

Fixed

  • HasMany field fixed resolve method.
laravel-restify - 4.5.2

Published by binaryk almost 4 years ago

Fixed

  • Fixed bug: get_class() expects parameter 1 to be object, null given
laravel-restify - 4.5.1

Published by binaryk almost 4 years ago

Added

  • Added MorphOne field.
laravel-restify - 4.5.0

Published by binaryk almost 4 years ago

Added

  • Sorting by belongsTo relationship:

Sometimes you may need to sort by a belongsTo relationship. This become a breeze with Restify. Firstly you have to
instruct your sort to use a relationship:

// PostRepository
use Binaryk\LaravelRestify\Fields\BelongsTo;
use Binaryk\LaravelRestify\Filters\SortableFilter;

public static function sorts(): array
{
    return [
        'users.name' => SortableFilter::make()
            ->setColumn('users.name')
            ->usingBelongsTo(
                BelongsTo::make('user', 'user', UserRepository::class),
        )
    ];
}

Make sure that the column is fully qualified (include the table name).

The request could look like:

GET: /api/restify/posts?sort=-users.name

This will return all posts, sorted descending by users name.

laravel-restify - 4.4.0

Published by binaryk almost 4 years ago

Added

  • Support for integer column type for the artisan restify:stub command.

  • Support for managing related entities via Eager fields. For example, if you want to have in relationships an BelongsTo field:

//PostRepository.php

public static function getRelated()
     {
         return [
             'owner' => BelongsTo::make('owner', 'owner', UserRepository::class),
         ];
    }

Then you can get it via related as usual:

/api/restify/posts?related=owner

And the returned object in the relationships will be formatted using UserRepository fields, so you can attach policies and permissions for specific fields in the repository itself.

laravel-restify - 4.3.0

Published by binaryk almost 4 years ago

Changed

  • The format of filters related repository will include a new key:
'repository' => {
 'key' => 'posts',
 'url' => 'api/restify/posts',
 'display_key' => 'id',
 'title' => 'Posts'
}
laravel-restify - 4.2.0

Published by binaryk almost 4 years ago

Added

Match definition

You can implement a match filter definition, and specify for example related repository:

  public static $match = [
        'title' => 'string',
        'user_id' => MatchFilter::make()
            ->setType('int')
            ->setRelatedRepositoryKey(UserRepository::uriKey()),
];

When you will list this filter (with posts/filters?only=matches), you will get:

  {
      "class": "Binaryk\LaravelRestify\Filters\MatchFilter"
      "key": "matches"
      "type": "string"
      "column": "title"
      "options": []
    },
    {
      "class": "Binaryk\LaravelRestify\Filters\MatchFilter"
      "key": "matches"
      "type": "int"
      "column": "user_id"
      "options": []
      "related_repository_key": "users"
      "related_repository_url": "//users"
    }
laravel-restify - 4.1.1

Published by binaryk almost 4 years ago

Changed

  • Changed the method signature of the fromRelation and fromBuildermethods for the repository cast.
    abstract public static function fromBuilder(RestifyRequest $request, Builder $builder, Repository $repository): Collection;

    abstract public static function fromRelation(RestifyRequest $request, Relation $relation, Repository $repository): Collection;
laravel-restify - 4.1.0

Published by binaryk almost 4 years ago

Added

  • Support for using a custom related cast class (aka transformer). You can do so by modifying the restify.casts.related property. The default related cast is Binaryk\LaravelRestify\Repositories\Casts\RelatedCast.

The cast class should extends the Binaryk\LaravelRestify\Repositories\Casts\RepositoryCast abstract class.

Copy the default config to your restify.php configuration:

    'casts' => [
        /*
        |--------------------------------------------------------------------------
        | Casting the related entities format.
        |--------------------------------------------------------------------------
        |
        */
        'related' => \Binaryk\LaravelRestify\Repositories\Casts\RelatedCast::class,
    ],
laravel-restify - 4.0.1

Published by binaryk almost 4 years ago

Fixed

  • Fix: Fallback for plain related values
laravel-restify - 4.0.0

Published by binaryk almost 4 years ago

Added

  • Available filters.
  • Fields for relations.
  • Security improvements.
  • Mock data generator: php artisan restify:stub users --count=10 now support relations

And much much more, see official documentation.

laravel-restify - 3.18.0

Published by binaryk almost 4 years ago

Fixed

Psalm comments.

laravel-restify - 3.17.0

Published by binaryk about 4 years ago

Package Rankings
Top 6.09% on Packagist.org
Related Projects