Download the PHP package wappcode/gqlpdss without Composer

On this page you can find all versions of the php package wappcode/gqlpdss. 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 gqlpdss

GQLPDSS-lib

Ingresa al siguiente link para más información. Quick Start

Intalar

Usar Composer

Ejecutar

./composer.phar init

Agregar al archivo composer.json las referencias a la libreria

{
"name": "name/project",
"type": "project",
"require": {
    "wappcode/gqlpdss": "^2.0.0"
},
}

Ejecutar

./composer.phar install

Crear estructura de directorios

config
data
modules
public

Crear módulo principal AppModule en la carpeta modules

Crear la siguiente estructura de directorios

modules
    AppModule
        config
        src
            Entities
            Graphql
            Services

Crear archivo modules/AppModule/src/Services/AppRouter.php con el siguiente contenido

<?php

namespace AppModule\Services;

use GPDCore\Library\RouteModel;
use GPDCore\Library\AbstractRouter;
use GPDCore\Controllers\GraphqlController;

    class AppRouter extends AbstractRouter
    {

        protected function addRoutes()
        {
            $GraphqlMethod = $this->isProductionMode ? 'POST' : ['POST','GET'];

            // Agrega las entradas para consultas graphql
            $this->addRoute(new RouteModel($GraphqlMethod, '/api', GraphqlController::class));

            // Las demás rutas deben ir abajo para poder utilizar la configuración de los módulos y sus servicios

            // entrada dominio principal

            // ... otras rutas
        }

    }

Agregar el archivo modules/AppModule/config/module.config.php

<?php

return [];

Agregar el archivo modules/AppModule/src/AppModule.php

<?php

namespace AppModule;

use GPDCore\Library\AbstractModule;
use GraphQL\Type\Definition\Type;

class AppModule extends AbstractModule {

    /**
    * Array con la configuración del módulo
    *
    * @return array
    */
    function getConfig(): array {
        return require(__DIR__.'/../config/module.config.php');
    }
    function getServicesAndGQLTypes(): array
    {
        return [
            'invokables' => [],
            'factories'=> [],
            'aliases' => []
        ];
    }
    /**
    * Array con los resolvers del módulo
    *
    * @return array array(string $key => callable $resolver)
    */
    function getResolvers(): array {
        return [];
    }
    /**
    * Array con los graphql Queries del módulo
    *
    * @return array
    */
    function getQueryFields(): array {
        return [
            'echo' =>  [
                'type' => Type::nonNull(Type::string()),
                'args' => [
                    'message' => Type::nonNull(Type::string())
                ],

                'resolve' => function($root, $args) { return $args["message"];}
            ],
        ];
    }
    /**
    * Array con los graphql mutations del módulo
    *
    * @return array
    */
    function getMutationFields(): array {
        return [];
    }

}

Agregar al archivo composer.json el siguiente código

 "autoload": {
    "psr-4": {
        "AppModule\\": "modules/AppModule/src/"
    }
}

Ejecutar ./composer.phar dump-autoload -o

Crear un archivo para sobreescribir la configuración de los módulos

Crear un archivo public/index.php con el siguiente contenido

Agregar archivo config/doctrine.entities.php con el siguiente contenido

<?php

return  [
    "AppModule\Entities" => __DIR__."/../modules/AppModule/src/Entities",
];

Agregar archivo config/doctrine.local.php con el siguiente contenido

<?php
return [
    "driver"=> [
        'user'     =>   '',
        'password' =>   '',
        'dbname'   =>   '',
        'driver'   =>   'pdo_mysql',
        'host'   =>     '127.0.0.1',
        'charset' =>    'utf8mb4'
    ],
    "entities"=> require __DIR__."/doctrine.entities.php"
];

Crear archivo cli-config.php con el siguiente código

<?php

use GPDCore\Factory\EntityManagerFactory;
use Doctrine\ORM\Tools\Console\ConsoleRunner;

require_once __DIR__."/vendor/autoload.php";
$options = require __DIR__."/config/doctrine.local.php";
$cacheDir = __DIR__ . "/data/DoctrineORMModule";
$entityManager = EntityManagerFactory::createInstance($options, $cacheDir, true, '');

return ConsoleRunner::createHelperSet($entityManager);

Crear entities en AppModule

Crear archivo modules/AppModule/src/Entities/Post.php

<?php

declare(strict_types=1);

namespace GraphQLTests\Doctrine\Blog\Model;

use DateTimeImmutable;
use Doctrine\ORM\Mapping as ORM;
use GPDCore\Entities\AbstractEntityModel;

/**
*
* @ORM\Entity
*
*/
final class Post extends AbstractEntityModel
{
    const STATUS_PRIVATE = 'private';
    const STATUS_PUBLIC = 'public';

    /**
    * @var string
    *
    * @ORM\Column(type="string", length=50, options={"default" = ""})
    */
    private $title = '';

    /**
    * @var string
    *
    * @ORM\Column(type="text")
    */
    private $body = '';

    /**
    * @var DateTimeImmutable
    *
    * @ORM\Column(type="datetime_immutable")
    */
    private $publicationDate;

    /**
    * @var string
    *
    * @ORM\Column(type="string", options={"default" = Post::STATUS_PRIVATE})
    */
    private $status = self::STATUS_PRIVATE;

    /**
    *
    * @return  string
    */
    public function getTitle(): string
    {
        return $this->title;
    }

    /**
    *
    * @param  string  $title
    *
    * @return  self
    */
    public function setTitle(string $title)
    {
        $this->title = $title;

        return $this;
    }

    /**
    *
    * @return  string
    */
    public function getBody(): string
    {
        return $this->body;
    }

    /**
    *
    * @param  string  $body
    *
    * @return  self
    */
    public function setBody(string $body)
    {
        $this->body = $body;

        return $this;
    }

    /**
    *
    * @return  DateTimeImmutable
    */
    public function getPublicationDate(): DateTimeImmutable
    {
        return $this->publicationDate;
    }

    /**
    *
    * @param  DateTimeImmutable  $publicationDate
    *
    * @return  self
    */
    public function setPublicationDate(DateTimeImmutable $publicationDate)
    {
        $this->publicationDate = $publicationDate;

        return $this;
    }

    /**
    *
    * @return  string
    */
    public function getStatus()
    {
        return $this->status;
    }

    /**
    *
    * @param  string  $status
    *
    * @return  self
    */
    public function setStatus(string $status)
    {
        $this->status = $status;

        return $this;
    }
}

Actualizar archivo doctrine.entities.php con la ubicación de las entidades

return  [
        "AppModule\Entities" => __DIR__."/../modules/AppModule/src/Entities",
]

Ejecutar el siguiente comando para generar el código SQL para actualizar la base de datos

./vendor/bin/doctrine orm:schema-tool:update --dump-sql

O Ejecutar el siguiente comando para actualizar la base de datos

./vendor/bin/doctrine orm:schema-tool:update --force

NOTA: Estos comandos no deben ser utilizados en producción

Iniciar con el comándo

php -S localhost:8000 public/index.php

Para consultar api Graphql la ruta es http://localhost:8000/api

API

ConnectionTypeFactory

Clase que genera tipos connection para consultas de listas con paginación

Metodos

createConnectionType (\GraphQL\Type\Definition\ObjectType $type, string $name, string $description): \GraphQL\Type\Definition\ObjectType

Crea un tipo connection con los siguientes campos

{
    totalCount: int!
    pageInfo: PaginationInput {
        hasPreviousPage: bool!
        hasNextPage: bool!
        startCursor: string!
        endCursor: string!
    },
    edges: [EdgeType]! {
        cursor: string!,
        node: ObjectType!
    }
}

createEdgeType(\GraphQL\Type\Definition\ObjectType $nodeType): \GraphQL\Type\Definition\ObjectType

Crea un tipo Edge

{
    cursor: string!,
    node: ObjectType!
}

All versions of gqlpdss with dependencies

PHP Build Version
Package Version
Requires php Version >7.1
doctrine/orm Version ^2.10.2
doctrine/dbal Version 3.1.4
symfony/yaml Version 2.*
symfony/cache Version ^5.3
webonyx/graphql-php Version ^14.11
laminas/laminas-servicemanager Version ^3.7
ecodev/graphql-doctrine Version ^7.1
nikic/fast-route Version ^1.3
doctrine/annotations Version ^1.13
wappcode/pdss-utilities Version ^3.2
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 wappcode/gqlpdss contains the following files

Loading the files please wait ....