PHPackages                             flooris/prestashop-models - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. flooris/prestashop-models

ActiveLibrary[Database &amp; ORM](/categories/database)

flooris/prestashop-models
=========================

Collection of Eloquent model files for using Laravel with Prestashop data

v2.4.2(10mo ago)105.7k↓30.4%7[2 PRs](https://github.com/flooris/flooris-prestashop-models/pulls)MITPHPPHP ^8.2CI passing

Since Jul 17Pushed 6mo ago1 watchersCompare

[ Source](https://github.com/flooris/flooris-prestashop-models)[ Packagist](https://packagist.org/packages/flooris/prestashop-models)[ RSS](/packages/flooris-prestashop-models/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (1)Versions (41)Used By (0)

flooris-prestashop-models
=========================

[](#flooris-prestashop-models)

**PrestaShop Models for Laravel Tests and Factories**

This package provides PrestaShop model support for Laravel applications, with a focus on enhancing testing workflows and facilitating the generation of Laravel factories for PrestaShop data.

You can find the package at [GitHub - flooris-prestashop-models](https://github.com/flooris/).

---

Overview
--------

[](#overview)

The `flooris-prestashop-models` package helps integrate PrestaShop models with Laravel applications, making it easier to write tests and generate database records using Laravel factories. This is particularly useful when you're working with PrestaShop's complex data structures and want to take advantage of Laravel’s powerful testing and factory generation tools.

---

Installation
------------

[](#installation)

To get started, you can install the package via Composer:

```
composer require flooris/flooris-prestashop-models
```

Once installed, the package will be ready to use in your Laravel application, and you can start using PrestaShop models within your Laravel tests and factories.

---

Usage
-----

[](#usage)

The package allows you to interact with PrestaShop models as Laravel Eloquent models, simplifying the process of creating and manipulating PrestaShop data. You can use it with Laravel's built-in **Factories** and **Testing** capabilities.

### Example Usage

[](#example-usage)

Here’s an example of how to use a PrestaShop model in a Laravel factory:

```
use Flooris\Prestashop\Models\Order\PrestaShop\Product;

Product::factory()->create([
    'name' => 'Sample Product',
    'price' => 19.99,
]);
```

This will create a new product in your PrestaShop database using the data defined in the factory.

### Factory Configuration

[](#factory-configuration)

You can define custom factories for PrestaShop models. For example, to create a factory for a PrestaShop product, you might set up a factory like this:

```
use Faker\Generator as Faker;

$factory->define(Flooris\Prestashop\Models\Order\PrestaShop\Product::class, function (Faker $faker) {
    return [
        'name' => $faker->word,
        'price' => $faker->randomFloat(2, 1, 100),
        // Add other product fields here
    ];
});
```

---

Extending the Package
---------------------

[](#extending-the-package)

While the `flooris-prestashop-models` package provides integration with common PrestaShop models, you may find the need to extend it further for your own project-specific requirements. Here are some ways you can extend or modify the package:

In some cases, you might want to add relationships or custom logic to an existing PrestaShop model. For example, if you want to extend the ProductAttribute model, you can create a new class like this:

```
namespace App\Models;

use Illuminate\Database\Eloquent\Relations\HasMany;
use Flooris\Prestashop\Models\Product\ProductAttribute as BaseProductAttribute;
use Flooris\Prestashop\Models\Product\ProductAttributeShop;

class ProductAttribute extends BaseProductAttribute
{
    public function productAttributeShops(): HasMany
    {
        return $this->hasMany(ProductAttributeShop::class, 'id_product_attribute', 'id_product_attribute');
    }

    public function isInStock(int $idShop): bool
    {
        /** @var ?ProductAttributeShop $productAttributeShop */
        $productAttributeShop = $this->productAttributeShops()->where('id_shop', $idShop)->first();

        if ($productAttributeShop?->available_date !== '0000-00-00') {
            return false;
        }

        return $this->productAttributeShops()->where('id_shop', $idShop)->first()?->active;
    }
}
```

---

Features
--------

[](#features)

- **PrestaShop Model Integration**: Easily integrate PrestaShop models into Laravel applications.
- **Factories for PrestaShop Data**: Create Laravel factories for PrestaShop entities, simplifying data seeding and testing.
- **Laravel Testing Compatibility**: Use PrestaShop models seamlessly in your Laravel tests.
- **Support for Common PrestaShop Models**: Includes support for common PrestaShop models like products, categories, and customers.

---

Testing
-------

[](#testing)

With this package, you can easily set up tests that involve PrestaShop data. Here’s an example of a simple test that creates a PrestaShop product:

```
use Flooris\Prestashop\Models\Order\PrestaShop\Product;
use Tests\TestCase;

class ProductTest extends TestCase
{
    public function test_product_creation()
    {
        $product = Product::factory()->create([
            'name' => 'Test Product',
            'price' => 10.99,
        ]);

        $this->assertDatabaseHas('products', [
            'name' => 'Test Product',
            'price' => 10.99,
        ]);
    }
}
```

This test will create a product in the database and check that the product exists with the expected values.

---

Contributing
------------

[](#contributing)

We welcome contributions to improve and extend the functionality of this package. If you'd like to contribute, please follow these steps:

1. Fork the repository on GitHub.
2. Create a new branch for your changes.
3. Make your changes and ensure tests pass.
4. Submit a pull request with a detailed description of your changes.

---

License
-------

[](#license)

This package is licensed under the MIT License. See [LICENSE](LICENSE) for more details.

---

Author
------

[](#author)

- **Flooris** - [GitHub Profile](https://github.com/flooris)

###  Health Score

54

—

FairBetter than 97% of packages

Maintenance61

Regular maintenance activity

Popularity33

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity88

Battle-tested with a long release history

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~83 days

Recently: every ~45 days

Total

36

Last Release

323d ago

Major Versions

v1.1.7 → v2.0.02021-01-21

PHP version history (3 changes)v2.0.0PHP ^7.4|^8.0

v2.1PHP ^7.4|^8.0|^8.1

v2.4.0PHP ^8.2

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1033813?v=4)[flooris](/maintainers/flooris)[@flooris](https://github.com/flooris)

---

Top Contributors

[![fkwakkenbos](https://avatars.githubusercontent.com/u/1029218?v=4)](https://github.com/fkwakkenbos "fkwakkenbos (14 commits)")[![WaterNinja05](https://avatars.githubusercontent.com/u/67736795?v=4)](https://github.com/WaterNinja05 "WaterNinja05 (10 commits)")[![JSTLWK](https://avatars.githubusercontent.com/u/14042234?v=4)](https://github.com/JSTLWK "JSTLWK (7 commits)")[![RDB-Flooris](https://avatars.githubusercontent.com/u/45361260?v=4)](https://github.com/RDB-Flooris "RDB-Flooris (5 commits)")[![DeYoran](https://avatars.githubusercontent.com/u/2778804?v=4)](https://github.com/DeYoran "DeYoran (5 commits)")[![TMBL-DEV](https://avatars.githubusercontent.com/u/43524471?v=4)](https://github.com/TMBL-DEV "TMBL-DEV (2 commits)")[![rikzwarthoff](https://avatars.githubusercontent.com/u/9021840?v=4)](https://github.com/rikzwarthoff "rikzwarthoff (1 commits)")

### Embed Badge

![Health badge](/badges/flooris-prestashop-models/health.svg)

```
[![Health](https://phpackages.com/badges/flooris-prestashop-models/health.svg)](https://phpackages.com/packages/flooris-prestashop-models)
```

###  Alternatives

[anourvalar/eloquent-serialize

Laravel Query Builder (Eloquent) serialization

11120.2M21](/packages/anourvalar-eloquent-serialize)[overtrue/laravel-versionable

Make Laravel model versionable.

585308.0k5](/packages/overtrue-laravel-versionable)[abbasudo/laravel-purity

elegant way to add filter and sort in laravel

514330.5k1](/packages/abbasudo-laravel-purity)[statamic-rad-pack/runway

Eloquently manage your database models in Statamic.

135192.6k5](/packages/statamic-rad-pack-runway)[dragon-code/laravel-deploy-operations

Performing any actions during the deployment process

240173.5k2](/packages/dragon-code-laravel-deploy-operations)[stayallive/laravel-eloquent-observable

Register Eloquent model event listeners just-in-time directly from the model.

2928.9k7](/packages/stayallive-laravel-eloquent-observable)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
