Skip to content

PrestaShop REST API

A modern REST API for PrestaShop

Binshops has been developing and maintaining a dedicated REST API solution for PrestaShop since 2019.

Quick Link: Download Demo

The goal has always been to make PrestaShop a strong backend for modern applications—not only for traditional PrestaShop storefronts, but also for headless commerce, mobile applications, custom frontends, and third-party integrations.

The result is a REST API that allows you to keep PrestaShop as your eCommerce backend while building the customer-facing or external applications with the technology of your choice.

The API can be used with modern frontend and application technologies such as:

  • Next.js
  • Nuxt.js
  • React
  • Angular
  • React Native
  • Flutter
  • Vue
  • And other frontend or application technologies

This gives you an architecture such as:

text
                    ┌── Next.js

                    ├── Nuxt.js

PrestaShop ── REST ─┼── React / Vue / Angular

                    ├── React Native

                    ├── Flutter

                    └── External Integrations

PrestaShop remains responsible for the eCommerce functionality, while the API provides the communication layer between PrestaShop and your application.

This is the foundation for a modern headless PrestaShop architecture.


Two versions of the API

Binshops provides two versions of the REST API.

Demo Version

The base version is publicly available on GitHub and can be used for learning, experimentation, and testing.

Download Demo

GitHub:github.com/binshops/prestashop-rest

The repository is public and provides a practical starting point for developers who want to understand how the REST API works and how to create their own endpoints.

The free version is primarily intended for demo and testing purposes rather than as the complete production solution.

REST API Official Version

The complete version is REST API Pro – For Front Applications & Integrations, available through the official PrestaShop Addons marketplace.

It provides the extended API functionality intended for production applications, headless projects, and integrations.

View REST API Official Version on PrestaShop Addons

Both versions are actively maintained. The complete version receives additional features and follows newer technologies as the PrestaShop and PHP ecosystems evolve.

The current v6 release, for example, includes support for PrestaShop 9.x, attribute-based API routing, API caching, administration and frontend APIs, and additional functionality such as the home page builder API.


Built for Headless PrestaShop

One of the main reasons to use this API is to separate the eCommerce engine from the customer-facing application.

Instead of building everything inside the traditional PrestaShop theme architecture, you can use PrestaShop as the backend and build your frontend independently.

For example:

text
┌──────────────────────────────┐
│        Next.js Frontend      │
│                              │
│  Products                    │
│  Categories                  │
│  Cart                        │
│  Checkout                    │
│  Customer Account            │
└──────────────┬───────────────┘

               │ REST API

┌──────────────────────────────┐
│          PrestaShop          │
│                              │
│ Products                     │
│ Customers                    │
│ Orders                       │
│ Cart                         │
│ Payments                     │
│ Shipping                     │
│ Administration               │
└──────────────────────────────┘

This architecture allows you to choose the frontend technology independently from the eCommerce backend.

The same PrestaShop installation can also serve multiple applications:

text
                       PrestaShop

                       REST API

          ┌────────────────┼────────────────┐
          │                │                │
          ▼                ▼                ▼
      Web Store        Mobile App      External App
      Next.js          React Native    Integration

This is particularly useful when a business wants to evolve beyond a traditional eCommerce website.


A Symfony-style API inside PrestaShop

One of the most important characteristics of the Binshops REST API is its development experience.

Starting with version 6, we introduced a much stronger Symfony-style architecture to the API.

The objective was simple:

A Symfony developer should be able to open the API code, understand the structure, and start developing immediately.

The project follows a structure similar to a modern Symfony application:

text
src
├── Cache
├── config
├── Controller
│   └── REST
│       ├── Admin
│       │   └── *
│       └── Front
│           └── *
├── Core
├── Form
├── Service
└── Util

This keeps the different responsibilities separated and provides a familiar environment for developers already working with Symfony.

More importantly, you do not need to build a separate API framework around PrestaShop.

You can add an endpoint directly to the module.


Create an API endpoint

Creating a new endpoint is intentionally simple.

Create a controller, define the route, and implement the action.

With the modern PHP attribute syntax:

php
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\Routing\Attribute\Route;

#[Route(
    '/new-products',
    name: 'binshops_rest_new_products',
    methods: ['GET']
)]
public function showNewProducts(): JsonResponse
{
    return new JsonResponse([
        'code' => 200,
        'success' => true,
        'message' => 'success',
        'psdata' => [
            // ...
        ],
    ]);
}

That's it.

There is no need to build a separate routing system or create a complicated API configuration for every endpoint.

The route is defined directly alongside the controller action.

Symfony itself recommends attributes as a convenient way to define routes next to the controller code, and PHP attributes are native to PHP 8+.


PHP Attributes and modern routing

Earlier versions of the API supported the annotation-based routing approach used by Symfony and PrestaShop versions in the PHP 7 era.

For example:

php
/**
 * @Route(
 *     "/rest/best-sales",
 *     name="best-sales",
 *     methods={"GET"}
 * )
 */
public function showBestSales()
{
    // ...
}

This approach remains familiar to developers working with older PrestaShop installations.

With modern PHP versions, however, PHP Attributes provide a cleaner and more native way to define routes:

php
#[Route(
    '/new-products',
    name: 'binshops_rest_new_products',
    methods: ['GET']
)]
public function showNewProducts(): JsonResponse
{
    // ...
}

This is the same style developers encounter in modern Symfony applications.

The result is a much more modern API development experience while remaining inside the PrestaShop environment.


Route parameters

You can also define parameters directly in your routes.

For example:

php
#[Route(
    '/products/{id}',
    name: 'binshops_rest_product',
    methods: ['GET']
)]
public function showProduct(int $id): JsonResponse
{
    // Use $id to retrieve the product.

    return new JsonResponse([
        'id' => $id,
    ]);
}

A request such as:

text
/rest/products/123

can therefore provide 123 to the controller as the $id parameter.

You can use the same Symfony routing concepts for more complex routes and parameters.


Controllers and namespaces

Controllers are regular PHP classes.

For example:

php
<?php

namespace PrestaShop\Module\BinshopsREST\Controller\REST\Front;

use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\Routing\Attribute\Route;

class ProductController
{
    #[Route(
        '/products/{id}',
        name: 'binshops_rest_product',
        methods: ['GET']
    )]
    public function showProduct(int $id): JsonResponse
    {
        return new JsonResponse([
            'id' => $id,
        ]);
    }
}

The important part is that the developer experience remains familiar to Symfony developers:

  • Namespaces
  • Controllers
  • Services
  • Dependency Injection
  • Symfony HTTP Foundation
  • Symfony routing
  • Symfony service configuration

You are working with Symfony principles while running inside the PrestaShop environment.


Dependency Injection

The API also supports Symfony's Dependency Injection component.

This means your controllers and services do not need to manually create their dependencies.

For example:

php
public function __construct(
    private ProductService $productService
) {
}

The service can then be injected automatically by the container.

This is one of the fundamental principles of Symfony development: dependencies are explicitly declared and provided by the service container rather than being manually instantiated throughout the application.

This becomes especially useful as your API grows.

Instead of putting all the business logic inside controllers, you can separate it into dedicated services.

For example:

text
Controller


ProductService

    ├── Product repository / data
    ├── Business logic
    └── Other services

This keeps API controllers small and makes the application easier to maintain and extend.


Defining Symfony services

Services can be configured in:

text
src/config/
├── index.php
└── services.yaml

For example:

yaml
services:

  PrestaShop\Module\BinshopsREST\Service\ProductService:
    autowire: true

  PrestaShop\Module\BinshopsREST\Service\ProductServiceInterface:
    alias: PrestaShop\Module\BinshopsREST\Service\ProductService

With this configuration, Symfony's service container knows how to create ProductService and which implementation should be used when ProductServiceInterface is requested.

You can then depend on the interface:

php
use PrestaShop\Module\BinshopsREST\Service\ProductServiceInterface;

class ProductController
{
    public function __construct(
        private ProductServiceInterface $productService
    ) {
    }
}

This allows the controller to depend on an abstraction rather than a concrete implementation.

That is the same type of dependency-injection pattern used in modern Symfony applications.


Symfony 6.4 and the LTS ecosystem

The API follows modern Symfony development principles and is designed to work naturally with the Symfony components available in the PrestaShop environment.

This makes the API particularly familiar to developers who already work with Symfony 6.x and its modern conventions.

The objective is not to create a proprietary API framework.

It is to make API development in PrestaShop feel as close as possible to the Symfony development experience developers already know.


Why this architecture?

The API is not simply a collection of predefined endpoints.

It is also a development environment for building new APIs on top of PrestaShop.

You can:

  • Use existing endpoints
  • Build new frontend APIs
  • Create administration APIs
  • Add APIs for custom modules
  • Connect third-party services
  • Build headless storefronts
  • Build mobile applications
  • Add custom business logic
  • Create reusable Symfony services
  • Use Dependency Injection
  • Create your own controllers and routes

This means the API can grow with your project.

You don't have to wait for a predefined endpoint to exist.

If your business requires a new endpoint, you can create it using the same Symfony-style development approach.


From PrestaShop to a modern application

The architecture can therefore be summarized as:

text
┌──────────────────────────────────────────────┐
│              Your Application                │
│                                              │
│ Next.js / Nuxt / React / Angular / Flutter  │
│ React Native / Vue / Other Applications      │
└──────────────────────┬───────────────────────┘

                       │ REST API

┌──────────────────────────────────────────────┐
│          Binshops REST API                   │
│                                              │
│ Symfony Routing                              │
│ Controllers                                  │
│ Services                                     │
│ Dependency Injection                         │
│ API Cache                                    │
│ Admin APIs                                   │
│ Front APIs                                   │
└──────────────────────┬───────────────────────┘


┌──────────────────────────────────────────────┐
│                  PrestaShop                  │
│                                              │
│ Products · Customers · Orders · Cart        │
│ Payments · Shipping · Catalog · Back Office │
└──────────────────────────────────────────────┘

This is the core idea behind Headless PrestaShop with Binshops REST API.

You keep PrestaShop as the mature eCommerce engine and use modern application technologies for everything around it.


Get started

There are two ways to start working with the Binshops REST API.

Demo Version

Explore the source code, install the module, experiment with endpoints, and learn how the API architecture works.

Download Demo

GitHub — Binshops PrestaShop REST API

REST API Pro

For production projects, headless storefronts, mobile applications, and more advanced integrations, use the complete version.

REST API Pro — PrestaShop Addons

The public repository also contains examples of the API routing approach, including the attribute-based syntax used in the current version.

Next

Once you have the API installed, continue with the API documentation to learn about the available endpoints, authentication, requests, responses, and how to create your own endpoints.

Binshops | Best In Shops - Technical Documentation