PHPackages                             yepwoo/laravel-parser - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. yepwoo/laravel-parser

ActiveLibrary[API Development](/categories/api)

yepwoo/laravel-parser
=====================

Easily load model relations / accessories / attributes from frontend without changing your API

02PHP

Since Jun 2Pushed 3y ago2 watchersCompare

[ Source](https://github.com/yepwoo/laravel-parser)[ Packagist](https://packagist.org/packages/yepwoo/laravel-parser)[ RSS](/packages/yepwoo-laravel-parser/feed)WikiDiscussions main Synced 4w ago

READMEChangelogDependenciesVersions (1)Used By (0)

[![Software License](https://camo.githubusercontent.com/074b89bca64d3edc93a1db6c7e3b1636b874540ba91d66367c0e5e354c56d0ea/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e737667)](LICENSE)

Installation
============

[](#installation)

`composer require yepwoo/laravel-parser`

Usage
=====

[](#usage)

Allow your application to load any model **relation** &amp; **attributes** in the response without the need of changing your API controllers. Pass a comma separated relations/attributes to your http request.

Loading relations
=================

[](#loading-relations)

Add `with` param to your HTTP request

`/posts?with=comments,tags,anyOtherRelation`

Loading Attributes / Accessors
==============================

[](#loading-attributes--accessors)

Add `append` param to your HTTP request

`/posts?append=my_custom_attribute`

How to use
==========

[](#how-to-use)

- Go to your controller and call `use Yepwoo\LaravelParser\LoadParser`
- Create new object from `LoadParser` class and pass `request` and `data` -&gt; `new LoadParser($request, $data)`
- If you want to load `relations` use `loadRelation` function.
- If you want to load `attributes/accessors` use `loadAttributes` function.

Here's a full example
---------------------

[](#heres-a-full-example)

```
