Download the PHP package zepgram/module-rest without Composer

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

Zepgram Rest

Overview

Zepgram Rest is a technical module designed to streamline the development of REST API integrations in Magento 2 projects. Utilizing the Guzzle HTTP client for dependency injection, this module offers a robust set of features aimed at reducing boilerplate code, improving performance, and enhancing debugging capabilities. By centralizing REST API interactions and leveraging Magento's built-in systems, Zepgram Rest simplifies the implementation process for developers.

Features

Zepgram Rest provides several key features to aid Magento developers in creating and managing RESTful services:

Installation

Guideline with ApiPool

  1. Create a RequestAdapter class for your service extending abstract class Zepgram\Rest\Model\RequestAdapter, this class represent your service contract adapter:
    • public const SERVICE_ENDPOINT: define the service endpoint
    • dispatch(DataObject $rawData): initialize data that you will adapt to request the web service
    • getBody(): implement body request
    • getHeaders(): implement headers
    • getUri(): implement uri endpoint (used to handle dynamic values)
    • getCacheKey(): implement cache key for your specific request (you must define a unique key)
  2. Create a system.xml, and a config.xml with a dedicated configName:
    • section: rest_api
    • group_id: $configName
    • fields:
      • base_uri
      • timeout
      • is_debug
      • cache_ttl
  3. Declare your service in di.xml by implementing Zepgram\Rest\Service\ApiProvider as VirtualClass, you can configure it by following the ApiProviderConfig
  4. Declare your RequestAdapter and ApiProvider in Zepgram\Rest\Service\ApiPoolInterface:
    • Add a new item in apiProviders[]:
      • The key is your custom RequestAdapter full namespace
      • The value is your ApiProvider as a VirtualClass
  5. Inject ApiPoolInterface in the class that will consume your API and use $this->apiPool->execute(RequestAdapter::class, $rawData) where:
    • RequestAdapter::class represents the request adapter declared in apiProviders[]
    • $rawData is an array of dynamic data that will be dispatch in dispatch() method

Basic guideline implementation

Instead of declaring your class in Zepgram\Rest\Service\ApiPoolInterface you can also directly inject your ApiProvider in a dedicated class:

Configuration

Store config

562 If you do not declare specific configuration, the request will fall back on default configuration. To override the default config, you must follow this system config pattern: rest_api/%configName%/base_uri

XML config

You can configure your service with Zepgram\Rest\Service\ApiProvider by creating a VirtualClass and customize its injections for your needs by following the below configuration:

Variable name Type Default value Is Optional Description
configName string default no Value to retrieve group id from system config
requestAdapter object RequestAdapter no Adapter class to build and customize the request
validator object null yes Validate the service contract
method string GET yes Request method
isJsonRequest boolean true yes Parse request array to json
isJsonResponse boolean true yes Parse response string to array
isVerify boolean true yes Enable SSL certificate verification

Implementation

Here is a simple implementation example with a service called Foxtrot using the order object as rawData:

FoxtrotOrderRequestAdapter.php

system.xml

config.xml

di.xml

OrderDataExample.php

Issues & Improvements

If you encountered an issue during installation or with usage, please report it on this github repository.
If you have good ideas to improve this module, feel free to contribute.


All versions of module-rest with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
guzzlehttp/guzzle Version ^7.0
magento/framework Version ^103.0.4
zepgram/module-base Version ~0.0.1
zepgram/module-json-schema Version ~0.1.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 zepgram/module-rest contains the following files

Loading the files please wait ....