Download the PHP package novabytes/laravel-odata without Composer

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

Laravel OData

Latest Version on Packagist Test Status Code Style Status Total Downloads

OData 4 for Laravel. Query (filter, select, expand, sort, paginate) and CRUD (create, read, update, delete) your Eloquent models via OData-compliant endpoints.

Built on top of novabytes-labs/odata-query-parser.

Table of Contents

Installation

Publish the config file:

Quick Start

Your API now accepts OData queries:

CRUD Endpoints

Enable auto-registered CRUD routes for your entity sets:

This registers the following routes:

Method Route Description
GET /api/Products List with OData query options
POST /api/Products Create entity
GET /api/Products/{key} Get single entity
PUT /api/Products/{key} Full replace
PATCH /api/Products/{key} Partial update
DELETE /api/Products/{key} Delete entity

Request bodies accept both PascalCase and snake_case field names. Only fields listed in allowedCreates/allowedUpdates are accepted — others return 400.

The CSDL and OpenAPI metadata endpoints automatically reflect CRUD capabilities.

Query Options

Option Example Description
$filter Price gt 100, contains(Name,'Widget'), Reviews/any(r:r/Rating gt 4) Filter results using comparison operators, functions, and lambda expressions
$select Name,Price Choose which properties to return (primary key always included)
$expand Category, Reviews($filter=Rating gt 4;$top=5) Eager-load relationships with optional nested query options
$orderby Price desc, Name asc,Price desc Sort results by one or more properties
$top 10 Limit the number of results
$skip 20 Skip a number of results (for pagination)
$count true Include total count in the response

All OData 4 comparison operators (eq, ne, gt, ge, lt, le), logical operators (and, or, not), and 30+ built-in functions are supported. See the parser README for the full list.

PascalCase Conversion

OData uses PascalCase property names. This package automatically converts them to Eloquent's snake_case:

OData Eloquent
Price price
CategoryId category_id
IsActive is_active
Category (expand) category (relationship)

Define your allowlists in snake_case — the conversion is handled for you.

Security

Every filterable, sortable, expandable, and selectable field must be explicitly whitelisted. Any request for a non-whitelisted field throws a 400 Bad Request by default.

If no allowlist is set for a given operation, that operation is unrestricted.

Entity Sets & Metadata

Register your models and their allowlists centrally in config/odata.php to enable:

When entity_sets are configured, controllers can omit explicit allowlists:

Metadata Endpoints

When metadata.enabled is true, two routes are registered automatically:

Endpoint Content-Type Description
GET {prefix}/$metadata application/xml OData v4 CSDL document — used by Power BI, Excel, and OData client libraries
GET {prefix}/openapi.json application/json OpenAPI 3.0 spec — use with Swagger UI, Redoc, or any API docs tool

Both are auto-generated from your Eloquent models and the entity_sets config. Zero annotations needed — columns, types, and nullability are discovered from the database schema; relationships are discovered via reflection.

Configuration

Advanced Usage

Using toBuilder()

Existing query as starting point

Requirements

License

MIT


All versions of laravel-odata with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
novabytes/odata-query-parser Version ^0.3.0 || ^0.2.0 || ^0.1.0
illuminate/database Version ^11.0|^12.0|^13.0
illuminate/http Version ^11.0|^12.0|^13.0
illuminate/support Version ^11.0|^12.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 novabytes/laravel-odata contains the following files

Loading the files please wait ...