Download the PHP package odysee/iliad without Composer

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

Iliad Documentation

Overview

Iliad is a PHP package built on top of Laravel's Eloquent ORM that provides a structured approach to developing REST APIs. It implements the repository pattern to create an abstraction layer between controllers and models, making your codebase more maintainable and testable.

Core Components

Repositories

Repositories are the heart of Iliad, providing a clean interface for data access and manipulation. They encapsulate the logic required to interact with data sources.

BaseRepository (Deprecated)

DEPRECATED: This class is deprecated and should not be used in new code. Use _BaseRepository instead.

The original base repository implementation that provides common methods for interacting with Eloquent models.

_BaseRepository

The current implementation of the repository pattern that leverages PHP 8 features and provides a more robust implementation.

Key features:

Implementing a Repository

When implementing a repository, you should extend _BaseRepository and implement the necessary methods:

Transaction Management

Iliad provides robust transaction handling to ensure database integrity.

Transaction Trait

The Transaction trait provides methods for managing database transactions:

Key features:

TransactionManager

The transaction management system that provides control and error handling:

Key features:

Query Builder Concern

The QueryBuilder trait provides methods for building and executing queries:

Key features:

Data Transfer Objects

Iliad uses Data Transfer Objects (DTOs) to encapsulate data and provide a consistent interface.

Dto

The base DTO class that provides common functionality:

Key features:

Controllers

Iliad provides base controllers that integrate with repositories to handle HTTP requests.

BaseController (Deprecated)

DEPRECATED: This class is deprecated and should not be used in new code.

The base controller that provides RESTful endpoints:

_BaseController

The recommended controller base class to extend for new controllers:

Controller

The base controller that provides the foundation for all controllers:

Implementing a Controller

Here's an example of implementing a controller that uses route attributes and integrates with a repository:

Key features:

Query String Parameters

Iliad supports various query string parameters to customize API responses:

with

Load relationships with the with parameter:

This will return a user with their posts and comments:

You can also load nested relationships:

scopes

Apply model scopes with the scopes parameter:

This will apply the active and premium scopes to the query.

paginate

Enable pagination with the paginate parameter:

This will return paginated results with 10 items per page.

sort

Sort results with the sort parameter:

This will sort users by name in ascending order, then by creation date in descending order.

groupBy

Group results with the groupBy parameter:

This will group users by their role:

exclude

Exclude specific relationships or fields:

This will load user posts but exclude the post body content.

Exception Handling

Iliad includes a custom exception handler that integrates with the transaction system.

HandlerDecorator

Decorates Laravel's exception handler to provide additional functionality:

Key features:

Validation

Iliad provides validation support through the Validator trait.

Validator Trait

Key features:

Utility Traits

Iliad includes several utility traits that provide additional functionality.

ResolveId

Resolves the currently authenticated user's ID:

WithData

Provides a method to get a data object from a model:

Editable

Provides methods for formatting messages with variable replacement:

Helper Functions

Iliad includes several helper functions in helpers.php:

Best Practices

Using Repositories

  1. Always extend _BaseRepository for new repositories
  2. Implement specific interfaces for each repository
  3. Define the required $model and $dataClass properties
  4. Inject TransactionManager in the constructor
  5. Call $this->transactionManager->commit() at the end of methods that modify data

Using Controllers

  1. Always extend _BaseController for new controllers
  2. Use route attributes (#[Prefix], #[Resource], etc.) to define routes
  3. Type-hint repository dependencies in the constructor
  4. Use strong typing for parameters and return values
  5. Use data objects (UserData, etc.) for request and response handling

Transaction Management

  1. Let Iliad handle transactions automatically for non-GET requests
  2. Use $this->transactionManager->commit() to commit transactions
  3. Don't worry about rollbacks - they happen automatically on exceptions
  4. For complex operations, use the transaction() method of the TransactionManager

Data Transfer Objects

  1. Create a specific DTO for each model
  2. Use YourData::from($model) to create DTOs from models
  3. Define the allowedRequestExcept() method to control what can be excluded

Query Parameters

  1. Use with to load relationships efficiently
  2. Use scopes to apply model scopes
  3. Use sort to control sorting order
  4. Use paginate for large result sets

Conclusion

Iliad provides a structured approach to developing REST APIs with Laravel. By following the repository pattern and using the provided base classes, you can create maintainable and testable APIs with minimal boilerplate code.

Remember to always use the most recent implementations (_BaseRepository) and avoid deprecated classes (BaseRepository and BaseController).


All versions of iliad with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
illuminate/database Version ^v11.43.2
spatie/laravel-data Version ^4.13.1
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 odysee/iliad contains the following files

Loading the files please wait ...