Download the PHP package amanank/hal-client without Composer

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

HAL API Client

A PHP client for interacting with HAL APIs.

Installation

1. Install via Composer

You can install the package via Composer. Run the following command in your terminal:

If you haven't already, make sure to include the Composer autoload file in your project:

2. Publish the Configuration File

After installing the package, you can publish the configuration file using the following Artisan command:

This will create a configuration file named hal-client.php in your config directory.

Note

Laravel's auto-discovery feature will automatically register the HalClientServiceProvider for you. You do not need to manually register it in your config/app.php file.

3. Configure hal-client.php

After registering the service provider, you need to configure it. Create a configuration file named hal-client.php in your config directory with the following content:

Make sure to set the HAL_API_BASE_URI and HAL_API_TOKEN environment variables in your .env file:

4. Generate Models

To generate models from your HAL API, run the following commands in your terminal:

This will generate the necessary models based on your HAL API schema and ensure they are properly autoloaded.

Usage

Basic Usage

After generating the models, you can use them directly from the Amanank\HalClient\Models\Discovered namespace or extend them in your App\Models namespace.

Using Models Directly

Extending Models

You can also extend the generated models in your App\Models namespace:

Creating and Updating Models

Searching Models

You can get models using the Model::get method, which accepts parameters $page = null, $size = null, and $sort = null, and returns a LengthAwarePaginator.

Additionally, any search methods exposed by the HAL API can be used directly. For example, User::findByLastName returns a collection, and User::getByEmail returns a User or null.

Working with Relationships

Working with Enums

Enums are located under the Amanank\HalClient\Models\Discovered\Enums namespace and are prefixed with the model name, such as UserStatusEnum and PostStatusEnum.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Contributing

  1. Fork the repository.
  2. Create a new branch (git checkout -b feature-branch).
  3. Make your changes.
  4. Commit your changes (git commit -am 'Add new feature').
  5. Push to the branch (git push origin feature-branch).
  6. Create a new Pull Request.

Support

If you have any questions or need support, please open an issue on the GitHub repository.


All versions of hal-client with dependencies

PHP Build Version
Package Version
Requires php Version >=7.2
illuminate/support Version ^8.0|^9.0|^10.0
guzzlehttp/guzzle Version ^7.0
illuminate/filesystem Version ^8.0|^9.0|^10.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 amanank/hal-client contains the following files

Loading the files please wait ....