C
C
codercat2017-09-16 15:13:35
Laravel
codercat, 2017-09-16 15:13:35

Where to store your own libraries?

Hello!
Interested in the issue of storing your own libraries in a laravel project. For example, I wrote classes for working with the VK API, the Odnoklassniki API, and I want to use them in the project. Where to put class files?
laravel 5.4+

Answer the question

In order to leave comments, you need to log in

4 answer(s)
M
Mokhirjon Naimov, 2017-09-16
@codercat

I do this, create a folder /app/Supportsand store parts of the project there as packages. For example like this:

/app/Supports
    /Cart
        /Facades
            CartFacade.php
        Cart.php
        ServiceProvider.php

And I register providers and facades (aliases) in /config/app.php.

A
Alex Wells, 2017-09-16
@Alex_Wells

github + composer

A
Andrew, 2017-09-16
@daaner

In services

K
Kirill Nesmeyanov, 2017-09-18
@SerafimArts

By the principle of symphony, you can create a src directory and add individual agnostic pieces there, connecting them with a composer (repository type: path). If the piece is not self-contained, then it makes sense to use a service layer: app/Services, for example.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question