Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Gaufrette Laravel Package

knplabs/gaufrette

View on GitHub
Deep Wiki
Context7

currentMenu: implementing-new-adapter

Implementing new Adapter

Let's say we want to support new storage system with existing Graufette API. The way to do it is by implementing a new adapter.

We will illustrate this by implementing example adapter for KnpStorage file system.

Spec BDD

We encourage contributors to start with describing a new adapter:

$ ./bin/phpspec describe Gaufrette/Adapter/KnpStorage
Specification for Gaufrette\Adapter\KnpStorage created in Gaufrette/spec/Gaufrette/Adapter/KnpStorageSpec.php.

We describe how our adapter is instantated and make sure it implements Gaufrette\Adapter interface:

<?php

class KnpStorageSpec extends ObjectBehavior
{
    function let(KnpStorage $storage)
    {
        $this->beConstructedWith($storage);
    }

    function it_is_adapter()
    {
        $this->shouldImplement('Gaufrette\Adapter');
    }
}

To get the benefits of PHPSpec code generator we run:

$ ./bin/phpspec run spec/Gaufrette/Adapter/KnpStorageSpec.php

You can continue to play with PHPSpec, read more on PHPSpec website.

Implementing adapter interface

Now all we need to do is to make sure KnpStorage implements all Gaufrette Adapterinterface methods.

Contibute it

Once you are sure your adapter is ready, share it with awesome Gaufrette community by submitting a pull request.

Thank you for doing this, you are awesome!

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
ilhamsyabani/laravel-volt-starter
thethunderturner/filament-latex
ghostcompiler/laravel-querybuilder
webrek/laravel-telescope-mongodb
anousss007/blatui
zatona-eg/zatona-eg-api
cocosmos/filament-sticky-save-bar
patrickbussmann/oauth2-apple
3brs/enterprise-security-bundle
anousss007/vigilance
supportpal/eloquent-model
ardenexal/fhir-models
laravel-at/laravel-image-sanitize
romalytar/yammi-audit-log-laravel
ardenexal/fhir-validation
arshaviras/weather-widget
laravel-chronicle/core
sunchayn/nimbus
daikazu/eloquent-salesforce-objects
unseen-codes/chat