Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Odataphpprod

Odataphpprod Laravel Package

adrotec/odataphpprod

Unmaintained PHP OData (v2) producer/server library for exposing read-only data sources. Supports Atom and JSON, $metadata, feeds/entries/properties, paging and query options ($filter, $select, $expand, $orderby, $top, $skip), plus optional media streaming.

View on GitHub
Deep Wiki
Context7

At a glance

Frequently asked questions about Odataphpprod
Is adrotec/odataphpprod compatible with Laravel 9.x or PHP 8.0+?
No, this package was last updated in 2017 and lacks support for modern PHP/Laravel versions. You’ll need to patch it manually or use a compatibility layer like Rector. Test thoroughly, as Symfony components (used by Laravel) may conflict with the library’s dependencies.
How do I integrate OData queries into Laravel’s routing system?
Since this is a standalone PHP library, you’ll need custom middleware to parse OData query parameters (e.g., `$filter`, `$expand`) and map them to Laravel’s request lifecycle. Example: `Route::get('/odata/{entity}', [ODataController::class])->middleware([ODataMiddleware::class]);`. Ensure middleware runs *before* Laravel’s default middleware to avoid conflicts.
Can I use this package with Laravel Eloquent models?
No, the package doesn’t natively support Eloquent. You’ll need to create a custom repository pattern to bridge OData queries (e.g., `$filter=age gt 30`) with Eloquent’s query builder. Example: `ODataRepository::applyQuery($query, $request)->get();`. This adds complexity and may require manual mapping of OData types to Eloquent attributes.
What OData features does this package support?
This library supports OData v2.0 read-only operations, including JSON/Atom formats, `$filter`, `$select`, `$expand`, `$orderby`, `$skip`, `$top`, and pagination. It also provides a `$metadata` endpoint for client discovery. However, it lacks write operations (POST/PUT/DELETE) and modern OData v4 features.
Why is this package marked as unmaintained? Should I still use it?
The package hasn’t seen updates since 2017, posing risks for PHP 8.0+/Laravel 9.x compatibility, security patches, and bug fixes. If you’re working with legacy OData systems or have no alternative, proceed with caution—plan for manual maintenance or fork the project. Consider modern alternatives like `odata-php/odata-v4-server` for new projects.
How do I handle OData’s $metadata endpoint in Laravel?
Implement the `IDataServiceMetadataProvider` interface to define your OData schema (e.g., entities, relationships, types). Register it in your Laravel service container and route `/$metadata` to a controller that returns the metadata document. Example: `Route::get('/$metadata', [ODataMetadataController::class, 'getMetadata']);`. Clients use this to understand your API structure.
Are there security risks with OData query parameters like $filter?
Yes, OData’s open query syntax enables risks like query injection (e.g., `$filter=1=1 OR 1=0`) or denial-of-service via deep traversal (e.g., `$expand=entity1/entity2/.../entity50`). Mitigate by validating queries against a whitelist, using Laravel’s rate limiting, and sanitizing inputs. Avoid dynamic SQL generation where possible.
Can I use this package for both REST and OData endpoints in the same Laravel app?
Technically yes, but it requires careful routing and middleware separation. Use route groups or prefixes (e.g., `/api/odata/*` vs `/api/rest/*`) to isolate OData logic. Ensure middleware like CORS or auth don’t interfere with OData’s query parsing. Test thoroughly for conflicts, especially if using Laravel’s built-in API resources.
What alternatives exist for OData in Laravel if this package is too risky?
For modern Laravel apps, consider GraphQL (via `spatie/laravel-graphql` or `laravel-graphql`) or REST APIs with query parameters (e.g., `?filter[age]=gt:30`). If OData is non-negotiable, evaluate `odata-php/odata-v4-server` (active maintenance) or `jenssegers/odata` (though also unmaintained). For new projects, weigh OData’s complexity against REST/GraphQL’s broader ecosystem support.
How do I test OData endpoints in Laravel?
Use tools like [OData Playground](https://odataplayground.azurewebsites.net/) or Postman to validate queries. For Laravel tests, mock the `IDataServiceQueryProvider` and `IDataServiceMetadataProvider` interfaces to isolate logic. Test edge cases like malformed queries, unsupported operators, and pagination limits. Laravel’s Pest/PHPUnit can verify HTTP responses, but OData-specific validation requires custom assertions.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
althinect/enum-permission
andydefer/laravel-actions
aimeos/prisma
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky
spatie/mailcoach-vapor