Download the PHP package yehia-tarek/laravel-erpnext without Composer

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

Laravel ERPNext

Latest Version on Packagist Total Downloads License

A robust, fluent Laravel package for seamlessly interacting with the ERPNext / Frappe REST API. It provides an elegant interface for CRUD operations, a powerful query builder, typed document resources, file uploads, and multiple authentication strategies.


📋 Table of Contents


Requirements

Dependency Version
PHP ^8.1
Laravel ^10.0 or ^11.0
Guzzle ^7.5

Installation

You can install the package via Composer:

Publish the configuration file to define your ERPNext connection settings:

Configuration

Add your ERPNext credentials to your application's .env file. The package supports multiple authentication methods, with Token Authentication being the recommended approach for API integrations.

Generating API Keys in ERPNext

To use Token Authentication, generate API keys from your ERPNext instance:

  1. Go to User List → open the desired user.
  2. Click on the Settings tab.
  3. Expand the API Access section and click Generate Keys.
  4. Copy the API Secret immediately (it is only shown once).
  5. Note the API Key displayed in the same section.

Authentication

The package automatically handles authentication based on your .env configuration.


Quick Start

After configuring your .env file, you can verify the connection using the ERPNext facade:


Usage

CRUD Operations

The package provides intuitive methods to interact with ERPNext documents.

Create a Document

Read a Document

Update a Document

Delete a Document

Fluent Query Builder

Retrieve multiple documents using a fluent, Eloquent-like query builder that wraps the GET /api/resource/:doctype endpoint.

Available Builder Methods

Method Description
fields(array) Specify which fields to fetch.
filter(field, op, value) Add an AND filter condition.
filters(array) Add multiple AND filters at once.
orFilter(field, op, value) Add an OR filter condition.
expand(array) Expand specific link fields inline.
orderBy(field, direction) Sort results (asc or desc).
limit(int) Limit the number of records returned.
offset(int) Skip a specific number of records.
paginate(page, perPage) Utilize page-based pagination.
asList() Return results as a List[List] instead of List[dict].
debug() Include executed SQL in the response.
get() Execute the query and return an array.
first() Execute and return the first item or null.
count() Return the total count of matching documents.

Supported Filtering Operators

Remote Method Calls

Call any whitelisted Python method on your ERPNext instance.

File Uploads

Upload files directly from your local filesystem or via raw content.

Upload from Local Path

Upload from Raw Content


Advanced Features

Typed Document Resources

For a more structured, object-oriented approach, you can define typed resources that extend the base Document class. This provides an Eloquent-like experience for specific DocTypes.

Usage Example:

Multiple Connections

If you need to interact with multiple ERPNext instances (e.g., staging and production), define them in config/erpnext.php:

You can easily switch connections using the connection() method:


Error Handling

The package throws specific exceptions for different API error scenarios, allowing you to handle them gracefully.

Exception Trigger
AuthenticationException 401/403 responses or missing credentials.
DocumentNotFoundException 404 response from ERPNext.
ValidationException ERPNext ValidationError (422).
ERPNextException Fallback for all other API errors.

Example:


Testing

Run the package tests using Composer:

Mocking in Your Application Tests

You can easily mock the ERPNext facade in your application's test suite:


License

The MIT License (MIT). Please see LICENSE for more information.


All versions of laravel-erpnext with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
guzzlehttp/guzzle Version ^7.5
illuminate/support Version ^10.0|^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 yehia-tarek/laravel-erpnext contains the following files

Loading the files please wait ...