Giter VIP home page Giter VIP logo

api-tools's People

Contributors

alexdenvir avatar ekosogin avatar evandotpro avatar ezimuel avatar geerteltink avatar michalbundyra avatar ocramius avatar ralphschindler avatar rogervila avatar samsonasik avatar snapshotpl avatar tafax avatar weierophinney avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

api-tools's Issues

Can't access old service with new version

I had version (1) with service:
/api/notification
Created new version (2) with new service:
/api/reset-bagde

Default version is 1.

In version 2 I changed /api/notification logic, only for version 2.
/api/notification was copied in V2 folder and I changed it, but the problem is I can't access v2/api/notification :(

response is:
{
"type": "http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html",
"title": "Not Found",
"status": 404,
"detail": "Page not found."
}

Can someone explain me, why? and is the problem in version of apigility?
"zfcampus/zf-apigility": "1.0.2"

by this video this should work: https://youtu.be/D_mcntk4tXI?t=1241


Originally posted by @zbintiosul at zfcampus/zf-apigility#147

returning JSON 404

Since it is an API. When an endpoint does not exists (route is not found), shouldn't it return a 404 with response in JSON instead of error/404.phtml or some other HTTP code with a JSON response?


Originally posted by @rcapile at zfcampus/zf-apigility#191

I'm getting a blank page

I've been trying to use apigility with doctrine for a long time now, but due the updates it was really hard to find a compatible version and now I'm having a weird behavior.
I will put all the steps I made here so you can reproduce and see for yourself.
The problem here is: I have doctrine orm module installed, configured, and I'm getting the information, it's returning everything if I var_dump or print_r, however when I try to pass that information (array) via return $users on the resource method, all that appears is a blank page.

1 - Install the apigility version 1.3.1 (The only version that composer didn't screamed with doctrine orm module compatibility errors):

composer create-project -sdev zfcampus/zf-apigility-skeleton:^1.3.1

2 - Update using composer (the --lock is to make sure it won't update to the latest versions and mess everything up)

composer update --lock

3 - Put the doctrine requirement on your composer.json:

"require": {
    // ....
    "doctrine/doctrine-orm-module": "0.*"
},

4 - Update using composer, again in order to add the doctrine to the vendor folder - and to the lock file as well:

composer update --lock

5 - Put the necessary modules information in order to load the modules - config/modules.config.php:

'DoctrineModule',
'DoctrineORMModule',

6 - Creating the necessary configuration files:

config/autoload/doctrine-orm.global.php:

<?php
return array(
    'doctrine' => array(
        'connection' => array(
            'orm_default' => array(
                'driverClass' => 'Doctrine\DBAL\Driver\PDOMySql\Driver',
                'params' => array(
                    'host'     => 'localhost',
                    'port'     => '3306',
                ),
            ),
        ),
    ),
);

config/autoload/doctrine-orm.local.php:

<?php
return array(
    'doctrine' => array(
        'connection' => array(
            'orm_default' => array(
                'params' => array(
                    'user'     => 'root',
                    'password' => '',
                    'dbname'   => 'apigility',
                ),
            ),
        ),
    ),
);

7 - Enter in development mode:

php public/index.php development enable

8 - Creating the domain model module (User - under module folder):

module/User/config/module.config.php:

<?php
return array(
    'doctrine' => array(
        'driver' => array(
            'my_annotation_driver' => array(
                'class' => 'Doctrine\\ORM\\Mapping\\Driver\\AnnotationDriver',
                'cache' => 'array',
                'paths' => array(
                    0 => __DIR__ . '/../src/User/Entity',
                ),
            ),
            'orm_default' => array(
                'drivers' => array(
                    'User\\Entity' => 'my_annotation_driver',
                ),
            ),
        ),
    ),
);

module/User/src/User/Entity/User.php:

<?php

namespace User\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * @ORM\Entity
 */
class User {
    /**
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     * @ORM\Column(type="integer")
     */
    private $id;

    /**
     *
     * @var string @ORM\Column(name="name", type="string", length=255, nullable=true)
     */
    private $name;

    public function setName($name)
    {
        $this->name = $name;
        return $this;
    }

    public function getId()
    {
        return $this->id;
    }

    public function getName()
    {
        return $this->name;
    }

    public function setId($id)
    {
        $this->id = $id;
        return $this;
    }
}

9 - Create the table on the database based on the entity:

php public/index.php orm:schema-tool:create

10 - Start apigility server and create an API called API and a REST service called Users:

php -S 0.0.0.0:8080 -t public public/index.php

11 - Change the files apigility created:

module/API/src/API/V1/Rest/Users/UsersResource.php:

<?php

namespace API\V1\Rest\Users;

use Doctrine\ORM\EntityManagerInterface;
use User\Entity\User;
use ZF\ApiProblem\ApiProblem;
use ZF\Rest\AbstractResourceListener;

class UsersResource extends AbstractResourceListener
{
    private $em;

    public function __construct(EntityManagerInterface $em) {
        $this->em = $em;
    }

    /**
     * Create a resource
     *
     * @param  mixed $data
     * @return ApiProblem|mixed
     */
    public function create($data) {
        return new ApiProblem(405, 'The POST method has not been defined');
    }

    /**
     * Delete a resource
     *
     * @param  mixed $id
     * @return ApiProblem|mixed
     */
    public function delete($id) {
        return new ApiProblem(405, 'The DELETE method has not been defined for individual resources');
    }

    /**
     * Delete a collection, or members of a collection
     *
     * @param  mixed $data
     * @return ApiProblem|mixed
     */
    public function deleteList($data) {
        return new ApiProblem(405, 'The DELETE method has not been defined for collections');
    }

    /**
     * Fetch a resource
     *
     * @param  mixed $id
     * @return ApiProblem|mixed
     */
    public function fetch($id) {
        $qb = $this->em->createQueryBuilder();
        $qb->select('u');
        $qb->from(User::class, 'u');
        $qb->where('u.id = :id');

        $qb->setParameters(array(
            'id' => $id
        ));

        $user = $qb->getQuery()->getArrayResult();

        return $user;
    }

    /**
     * Fetch all or a subset of resources
     *
     * @param  array $params
     * @return ApiProblem|mixed
     */
    public function fetchAll($params = array()) {
        $qb = $this->em->createQueryBuilder();
        $qb->select('u');
        $qb->from(User::class, 'u');

        $users = $qb->getQuery()->getArrayResult();

        return new UsersCollection($users);
    }

    /**
     * Patch (partial in-place update) a resource
     *
     * @param  mixed $id
     * @param  mixed $data
     * @return ApiProblem|mixed
     */
    public function patch($id, $data) {
        return new ApiProblem(405, 'The PATCH method has not been defined for individual resources');
    }

    /**
     * Replace a collection or members of a collection
     *
     * @param  mixed $data
     * @return ApiProblem|mixed
     */
    public function replaceList($data) {
        return new ApiProblem(405, 'The PUT method has not been defined for collections');
    }

    /**
     * Update a resource
     *
     * @param  mixed $id
     * @param  mixed $data
     * @return ApiProblem|mixed
     */
    public function update($id, $data) {
        return new ApiProblem(405, 'The PUT method has not been defined for individual resources');
    }
}

module/API/src/API/V1/Rest/Users/UsersResourceFactory.php:

<?php

namespace API\V1\Rest\Users;

use Doctrine\ORM\EntityManager;

class UsersResourceFactory
{
    public function __invoke($services)
    {
        $em = $services->get(EntityManager::class);
        return new UsersResource($em);
    }
}

module/API/src/API/V1/Rest/Users/UsersCollection.php:

<?php

namespace API\V1\Rest\Users;

use Zend\Paginator\Adapter\ArrayAdapter;
use Zend\Paginator\Paginator;

class UsersCollection extends Paginator
{
    public function __construct($userCollection) {
        parent::__construct(new ArrayAdapter($userCollection));
    }
}

Now, if i try to access: 127.0.0.1:8080/users all that I got is a blank page. The weird thing is that doctrine is returning everything from the database, just enter on UsersResource::fetchAll() and add var_dump($users) you will see that the array is there with all the values.

What is happening, anyone knows?


Originally posted by @viyirenov at zfcampus/zf-apigility#174

How to overcome limitations of GET? (X-HTTP-Method-Override?)

Is there a method in place to overcome GET limitations? For example, browsers/Apache have a maximum character limit on query strings. The ability to send POST but use GET as the overriden method is desired.

Sending a X-HTTP-Method-Override header is the suggested standard that many APIs support. (Google is behind this). I have not found this or any other workaround in Apigility.


Originally posted by @jdukleth at zfcampus/zf-apigility#175

ZF\ContentValidation\Validator\Db\[No]RecordExists exclude current entity by default?

I’m in running into a rather tricky situation, using NoRecordExists validtor within Apigility.

It’s quite easy to setup and force a field value to be unique like this:

'validators' => array(
    0 => array(
        'name' => 'ZF\\ContentValidation\\Validator\\Db\\NoRecordExists',
        'options' => array(
            'adapter' => 'Zend\\Db\\Adapter\\Adapter',
            'table' => 'mytable',
            'field' => 'myuniquefield',
        ),
    ),
)

However, this does not really work in real-life, since only POST requests deliver the expected results. Once you want to modify a records using PUT, this fails, because … well … the record exists already. In case of PUT/PATCH, I need to set up the validator to exclude the entity that’s being updated, like this:

'validators' => array(
    0 => array(
        'name' => 'ZF\\ContentValidation\\Validator\\Db\\NoRecordExists',
        'options' => array(
            'adapter' => 'Zend\\Db\\Adapter\\Adapter',
            'table' => 'mytable',
            'field' => 'myuniquefield',
            'exclude' => array(
                'field' => 'id',
                'value' => CURRENT_ENTITY_ID,
            ),
        ),
    ),
)

But I don’t know how to inject the requested entity’s ID into the options array. Wouldn’t it make sense, to have Apigility set these excludes for PUT/PATCH requests automatically?


Originally posted by @intellent at zfcampus/zf-apigility#181

An abstract factory could not create an instance

So I tried this tutorial to get a simple project running to see if I can use Apigility. So far no good.

Is it too old?

I get the error on GET /providers:

"type": "http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html",
  "title": "Internal Server Error",
  "status": 500,
  "detail": "An abstract factory could not create an instance of economycomparev1restproviderscontroller(alias: EconomyCompare\V1\Rest\Providers\Controller)."

I just want a simple CRUD example or I guess I will go back to Slim PHP and build my own stuff that I can get running...


Originally posted by @Zyles at zfcampus/zf-apigility#131

Unable to create db connected service on a database

Hy,

I've a problem with new apigility 1.3.1 project. I'm choose my db adapter, list table appear, all ok. I'm select One table and click on CREATE SERVICE.

Spinning appear but nothing happens.... database have 65 table, i don't understand why nothing appears. And no error message. I'm ask if the request is posted...

Name of the table are alphabetical, no majuscule, no number, no special char.

with an old another project on 1.1 it's working fine, but with another database.


Originally posted by @mtcocktail at zfcampus/zf-apigility#144

Upgrading from 1.1 to 2 causes all RPC calls to break

All RPC calls are broken when upgrading apigility when the content negotiation is set to JSON. They work when set to HalJson but the whole admin ui is broken because it is making RPC calls to get options for selection. The content negotiator is not detecting JSON properly and tries to find a legit view to open because of it. Would love a fix for this as I would like to get upgraded.


Originally posted by @parljohn at zfcampus/zf-apigility#161

Configurable Rest Collection Filters

Hi ,

I wonder, in apigility is there a way to configure filters that to be injected
into your rest collection based on configuration ?

At the moment I'm doing it programmatically like

public function fetchAll($criteria = [])
 {
     /** @var Paginator $paginator */
     $paginator = parent::fetchAll($criteria);

     $paginator->setFilter(
         $this->getServiceLocator()->get(PasswordCollectionFilter::class)
     );

     return $paginator;
 }

This filter injection can be done by configuration , smth like :

'zf-rest' => array(
 'Some\\Controller' => array(
    other configs ...
    'collection_class' => 'Some\\KerioEmailsCollection',
    'collection_filters' => [
          ExampleFilterCapitalLetters,
          AnotherExampleFilter
      ]
    other configs ..
)

Originally posted by @karborator at zfcampus/zf-apigility#192

Admin UI

Having many API's with a lot of services for each API, it would be nice if the API's are collapsed in the left menu or kind of hover with sub-menus.


Originally posted by @aburcheri at zfcampus/zf-apigility#179

Count on Oci8 adapter

Hello,

I can't get DB-Connected resources fetch single item from Oracle. I always get a "Item not found" message, but I've noticed that it only occurs when I call $resultSet->count(), because it returns null.

$resultSet = $this->table->select([ $this->identifierName => $id ]);

        if (0 === $resultSet->count()) {
            throw new \Exception('Item not found', 404);
        }

        return $resultSet->current();

Is there any restriction to the Oci8 adapter?

I can get it to work if I don't check count() function, but to do so, I have to overwrite every DB-Connected resource class.


Originally posted by @harrysbaraini at zfcampus/zf-apigility#142

Error creating deployment package

Perhaps it's my environment (windows) but everything else works great. When I go to create a deployment package (generate package), regardless of the package format, I receive "Error occurred building the package." What I am looking for is somewhere these messages, and perhaps more detail, are logged. Any advice so I can figure out what is going on?


Originally posted by @rominoff at zfcampus/zf-apigility#160

Respect existing config.php and local.php

Apigility should write to its own config files rather than rewriting existing files.
We've had to move the application's config out of global.php and into app.global.php because Apigility kept messing it up each time a change was made in the admin ui.
Eg. closures would break, and constants were being replaced with their values.


Originally posted by @dkmuir at zfcampus/zf-apigility#166

Documentation request - How to send alternative HTTP status code for POST on a collection (NOT a 201 CREATED)

What I really like about the ApiProblem object is that I can explicitly set the response code right there for handing off the right kind of problem e.g., a 422 for a domain-model validation problem or perhaps a 5xx if things really go south.

What seems to be missing in a regular response is to hand back an appropriate HTTP status code for the task at hand. A 201 make sense 90% of the time; however, sometimes an alternative response would make more sense. For the sake of this example, a 202 -- Accepted for processing, but not yet created is required (e.g., running a background task). How would one hand back the intended response but with the slight modification of altering the HTTP status code without short-circuiting the regular flow of adding in the HAL components and so forth?

Thanks


Originally posted by @jackdpeterson at zfcampus/zf-apigility#168

Adding custom data to a collection - Approaches suggested in mailing list feel wrong

@weierophinney mentioned a few approaches to getting additional metadata into a collection in the mailing list. While both technically valid and sufficient ways to get the job done ... they both feel wrong from two perspectives:

Approach 1 - return a ZF\Hal\Collection object directly from a resource.
--> downside here is that it loses the pagination information without extra work to get it fully configured. This feels like reinventing a wheel that Apigility already has works just fine. This probably wouldn't be so bad if this was a well documented approach in terms of adding in the pagination information where it reads from the configuration.

Approach 2 - use an rendering event and make modifications to the collection if it is an instanceof X collection.
--> The downside here is that the logic for this gets placed in a spot that is completely unrelated to the area where one would expect modifications to go (the resource, or the domain model if more complex). Typically, one would tie this event stuff in their module.php file around the onBootstrap method with extra handler methods. For developer B who has to work with / extend the code taken from developer A, those extra attributes would appear in a way that would seem like magic -- coming from nowhere. Furthermore, if one is reaching inside of a domain model ... the service locator must once again fetch dependencies to make that logic completable.

Is this something that can be planned for or at least get a better / documented approach for the 2.0 Apigility release?


Originally posted by @jackdpeterson at zfcampus/zf-apigility#173

DB connected not working

I was creating a new db connected service, but when I click create, the system does not end the process
apigility-error

This error is console of browser

TypeError: Cannot read property 'table_name' of undefined
    at a.e.ok (c22d22af.apigility.js:1)
    at 6a8334db.vendor.js:6
    at e (6a8334db.vendor.js:6)
    at k.$eval (6a8334db.vendor.js:5)
    at k.$apply (6a8334db.vendor.js:5)
    at HTMLButtonElement.<anonymous> (6a8334db.vendor.js:6)
    at HTMLButtonElement._.event.dispatch (6a8334db.vendor.js:2)
    at HTMLButtonElement.q.handle (6a8334db.vendor.js:2)

Originally posted by @LucasBurg at zfcampus/zf-apigility#149

Doc intro : Creating a REST Service

Hi

I started to learn apigility but I lost motivation after getting-started page.

i got this error in Creating a REST Service section ( using apgility 1.4 with php 7.0.8 )

Thank you

`composer require zfcampus/statuslib-example:dev-master ( even php composer.phar require "zfcampus/statuslib-example:~1.0-dev")
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

Problem 1
- Conclusion: remove zendframework/zend-mvc-i18n 1.0.0
- Conclusion: don't install zendframework/zend-mvc-i18n 1.0.0
- zendframework/zendframework 2.3.0 conflicts with zendframework/zend-mvc-i18n[1.0.0].
- zendframework/zendframework 2.3.1 conflicts with zendframework/zend-mvc-i18n[1.0.0].
- zendframework/zendframework 2.3.2 conflicts with zendframework/zend-mvc-i18n[1.0.0].
- zendframework/zendframework 2.3.3 conflicts with zendframework/zend-mvc-i18n[1.0.0].
- zendframework/zendframework 2.3.4 conflicts with zendframework/zend-mvc-i18n[1.0.0].
- zendframework/zendframework 2.3.5 conflicts with zendframework/zend-mvc-i18n[1.0.0].
- zendframework/zendframework 2.3.6 conflicts with zendframework/zend-mvc-i18n[1.0.0].
- zendframework/zendframework 2.3.7 conflicts with zendframework/zend-mvc-i18n[1.0.0].
- zendframework/zendframework 2.3.8 conflicts with zendframework/zend-mvc-i18n[1.0.0].
- zendframework/zendframework 2.3.9 conflicts with zendframework/zend-mvc-i18n[1.0.0].
- zendframework/zendframework 2.4.0 conflicts with zendframework/zend-mvc-i18n[1.0.0].
- zendframework/zendframework 2.4.1 conflicts with zendframework/zend-mvc-i18n[1.0.0].
- zendframework/zendframework 2.4.10 conflicts with zendframework/zend-mvc-i18n[1.0.0].
- zendframework/zendframework 2.4.2 conflicts with zendframework/zend-mvc-i18n[1.0.0].
- zendframework/zendframework 2.4.3 conflicts with zendframework/zend-mvc-i18n[1.0.0].
- zendframework/zendframework 2.4.4 conflicts with zendframework/zend-mvc-i18n[1.0.0].
- zendframework/zendframework 2.4.5 conflicts with zendframework/zend-mvc-i18n[1.0.0].
- zendframework/zendframework 2.4.6 conflicts with zendframework/zend-mvc-i18n[1.0.0].
- zendframework/zendframework 2.4.7 conflicts with zendframework/zend-mvc-i18n[1.0.0].
- zendframework/zendframework 2.4.8 conflicts with zendframework/zend-mvc-i18n[1.0.0].
- zendframework/zendframework 2.4.9 conflicts with zendframework/zend-mvc-i18n[1.0.0].
- Installation request for zendframework/zend-mvc-i18n ^1.0 -> satisfiable by zendframework/zend-mvc-i18n[1.0.0].
- Conclusion: don't install zendframework/zend-hydrator 2.2.1|install zendframework/zendframework 2.3.0|install zendframework/zendframework 2.3.1|install zendframework/zendframework 2.3.2|install zendframework/zendframework 2.3.3|install zendframework/zendframework 2.3.4|install zendframework/zendframework 2.3.5|install zendframework/zendframework 2.3.6|install zendframework/zendframework 2.3.7|install zendframework/zendframework 2.3.8|install zendframework/zendframework 2.3.9|install zendframework/zendframework 2.4.0|install zendframework/zendframework 2.4.1|install zendframework/zendframework 2.4.10|install zendframework/zendframework 2.4.2|install zendframework/zendframework 2.4.3|install zendframework/zendframework 2.4.4|install zendframework/zendframework 2.4.5|install zendframework/zendframework 2.4.6|install zendframework/zendframework 2.4.7|install zendframework/zendframework 2.4.8|install zendframework/zendframework 2.4.9
- Conclusion: remove zendframework/zend-hydrator 2.2.1|install zendframework/zendframework 2.3.0|install zendframework/zendframework 2.3.1|install zendframework/zendframework 2.3.2|install zendframework/zendframework 2.3.3|install zendframework/zendframework 2.3.4|install zendframework/zendframework 2.3.5|install zendframework/zendframework 2.3.6|install zendframework/zendframework 2.3.7|install zendframework/zendframework 2.3.8|install zendframework/zendframework 2.3.9|install zendframework/zendframework 2.4.0|install zendframework/zendframework 2.4.1|install zendframework/zendframework 2.4.10|install zendframework/zendframework 2.4.2|install zendframework/zendframework 2.4.3|install zendframework/zendframework 2.4.4|install zendframework/zendframework 2.4.5|install zendframework/zendframework 2.4.6|install zendframework/zendframework 2.4.7|install zendframework/zendframework 2.4.8|install zendframework/zendframework 2.4.9
- zendframework/zend-stdlib 2.7.0 requires zendframework/zend-hydrator ~1.0 -> satisfiable by zendframework/zend-hydrator[1.0.0, 1.1.0].
- zendframework/zend-stdlib 2.7.1 requires zendframework/zend-hydrator ~1.0 -> satisfiable by zendframework/zend-hydrator[1.0.0, 1.1.0].
- zendframework/zend-stdlib 2.7.2 requires zendframework/zend-hydrator ~1.0 -> satisfiable by zendframework/zend-hydrator[1.0.0, 1.1.0].
- zendframework/zend-stdlib 2.7.3 requires zendframework/zend-hydrator ~1.0 -> satisfiable by zendframework/zend-hydrator[1.0.0, 1.1.0].
- zendframework/zend-stdlib 2.7.4 requires zendframework/zend-hydrator ~1.0 -> satisfiable by zendframework/zend-hydrator[1.0.0, 1.1.0].
- zendframework/zend-stdlib 2.7.5 requires zendframework/zend-hydrator ~1.0 -> satisfiable by zendframework/zend-hydrator[1.0.0, 1.1.0].
- zendframework/zend-stdlib 2.7.6 requires zendframework/zend-hydrator ~1.1 -> satisfiable by zendframework/zend-hydrator[1.1.0].
- zendframework/zend-stdlib 2.7.7 requires zendframework/zend-hydrator ~1.1 -> satisfiable by zendframework/zend-hydrator[1.1.0].
- Can only install one of: zendframework/zend-hydrator[1.0.0, 2.2.1].
- Can only install one of: zendframework/zend-hydrator[1.1.0, 2.2.1].
- Installation request for zendframework/zend-hydrator (locked at 2.2.1) -> satisfiable by zendframework/zend-hydrator[2.2.1].
- Installation request for zfcampus/statuslib-example dev-master -> satisfiable by zfcampus/statuslib-example[dev-master].
- Conclusion: don't install zendframework/zend-stdlib 3.1.0|install zendframework/zend-stdlib 2.7.0|install zendframework/zend-stdlib 2.7.1|install zendframework/zend-stdlib 2.7.2|install zendframework/zend-stdlib 2.7.3|install zendframework/zend-stdlib 2.7.4|install zendframework/zend-stdlib 2.7.5|install zendframework/zend-stdlib 2.7.6|install zendframework/zend-stdlib 2.7.7|install zendframework/zendframework 2.3.0|install zendframework/zendframework 2.3.1|install zendframework/zendframework 2.3.2|install zendframework/zendframework 2.3.3|install zendframework/zendframework 2.3.4|install zendframework/zendframework 2.3.5|install zendframework/zendframework 2.3.6|install zendframework/zendframework 2.3.7|install zendframework/zendframework 2.3.8|install zendframework/zendframework 2.3.9|install zendframework/zendframework 2.4.0|install zendframework/zendframework 2.4.1|install zendframework/zendframework 2.4.10|install zendframework/zendframework 2.4.2|install zendframework/zendframework 2.4.3|install zendframework/zendframework 2.4.4|install zendframework/zendframework 2.4.5|install zendframework/zendframework 2.4.6|install zendframework/zendframework 2.4.7|install zendframework/zendframework 2.4.8|install zendframework/zendframework 2.4.9
- Conclusion: remove zendframework/zend-stdlib 3.1.0|install zendframework/zend-stdlib 2.7.0|install zendframework/zend-stdlib 2.7.1|install zendframework/zend-stdlib 2.7.2|install zendframework/zend-stdlib 2.7.3|install zendframework/zend-stdlib 2.7.4|install zendframework/zend-stdlib 2.7.5|install zendframework/zend-stdlib 2.7.6|install zendframework/zend-stdlib 2.7.7|install zendframework/zendframework 2.3.0|install zendframework/zendframework 2.3.1|install zendframework/zendframework 2.3.2|install zendframework/zendframework 2.3.3|install zendframework/zendframework 2.3.4|install zendframework/zendframework 2.3.5|install zendframework/zendframework 2.3.6|install zendframework/zendframework 2.3.7|install zendframework/zendframework 2.3.8|install zendframework/zendframework 2.3.9|install zendframework/zendframework 2.4.0|install zendframework/zendframework 2.4.1|install zendframework/zendframework 2.4.10|install zendframework/zendframework 2.4.2|install zendframework/zendframework 2.4.3|install zendframework/zendframework 2.4.4|install zendframework/zendframework 2.4.5|install zendframework/zendframework 2.4.6|install zendframework/zendframework 2.4.7|install zendframework/zendframework 2.4.8|install zendframework/zendframework 2.4.9
- zfcampus/statuslib-example dev-master requires zendframework/zend-stdlib ~2.3 -> satisfiable by zendframework/zend-stdlib[2.3.0, 2.3.1, 2.3.2, 2.3.3, 2.3.4, 2.3.5, 2.3.6, 2.3.7, 2.3.8, 2.3.9, 2.4.0, 2.4.1, 2.4.10, 2.4.2, 2.4.3, 2.4.4, 2.4.5, 2.4.6, 2.4.7, 2.4.8, 2.4.9, 2.5.0, 2.5.1, 2.5.2, 2.6.0, 2.7.0, 2.7.1, 2.7.2, 2.7.3, 2.7.4, 2.7.5, 2.7.6, 2.7.7], zendframework/zendframework[2.3.0, 2.3.1, 2.3.2, 2.3.3, 2.3.4, 2.3.5, 2.3.6, 2.3.7, 2.3.8, 2.3.9, 2.4.0, 2.4.1, 2.4.10, 2.4.2, 2.4.3, 2.4.4, 2.4.5, 2.4.6, 2.4.7, 2.4.8, 2.4.9].
- Can only install one of: zendframework/zend-stdlib[2.3.0, 3.1.0].
- Can only install one of: zendframework/zend-stdlib[2.3.1, 3.1.0].
- Can only install one of: zendframework/zend-stdlib[2.3.2, 3.1.0].
- Can only install one of: zendframework/zend-stdlib[2.3.3, 3.1.0].
- Can only install one of: zendframework/zend-stdlib[2.3.4, 3.1.0].
- Can only install one of: zendframework/zend-stdlib[2.3.5, 3.1.0].
- Can only install one of: zendframework/zend-stdlib[2.3.6, 3.1.0].
- Can only install one of: zendframework/zend-stdlib[2.3.7, 3.1.0].
- Can only install one of: zendframework/zend-stdlib[2.3.8, 3.1.0].
- Can only install one of: zendframework/zend-stdlib[2.3.9, 3.1.0].
- Can only install one of: zendframework/zend-stdlib[2.4.0, 3.1.0].
- Can only install one of: zendframework/zend-stdlib[2.4.1, 3.1.0].
- Can only install one of: zendframework/zend-stdlib[2.4.10, 3.1.0].
- Can only install one of: zendframework/zend-stdlib[2.4.2, 3.1.0].
- Can only install one of: zendframework/zend-stdlib[2.4.3, 3.1.0].
- Can only install one of: zendframework/zend-stdlib[2.4.4, 3.1.0].
- Can only install one of: zendframework/zend-stdlib[2.4.5, 3.1.0].
- Can only install one of: zendframework/zend-stdlib[2.4.6, 3.1.0].
- Can only install one of: zendframework/zend-stdlib[2.4.7, 3.1.0].
- Can only install one of: zendframework/zend-stdlib[2.4.8, 3.1.0].
- Can only install one of: zendframework/zend-stdlib[2.4.9, 3.1.0].
- Can only install one of: zendframework/zend-stdlib[2.5.0, 3.1.0].
- Can only install one of: zendframework/zend-stdlib[2.5.1, 3.1.0].
- Can only install one of: zendframework/zend-stdlib[2.5.2, 3.1.0].
- Can only install one of: zendframework/zend-stdlib[2.6.0, 3.1.0].
- Installation request for zendframework/zend-stdlib (locked at 3.1.0) -> satisfiable by zendframework/zend-stdlib[3.1.0].`


Originally posted by @FadelChafai at zfcampus/zf-apigility#178

How to set API Key and API Secret to clients?

I want to use Apigility to create an API that several clients will consume. What I need to do is something like Facebook does: people can create apps that connects to my API, and I can see what apps are connected.

Also I would like to be able to limit services for some apps. Something like app A can online view statuses, App B can view and post and edit statuses, App C can only edit statuses for examples.

Is that possible with apigility? Where can I find documentation for the API Keys and Secret?

In other words I want application based authorization instead of user based authorization that Oauth2 does.


Originally posted by @backstageel at zfcampus/zf-apigility#165

access zf2 container in RestAPI

Hi,
i try to access a value stored in a zf2 session container. In my ressource class (extends AbstractResourceListener) it is unfortunately NULL;

Why does this not work? Why is the container stored value empty?

fetchAll($params = array()):
$container = new Container("store_login");
$container->value = NOT NULL

create($data)
$container = new Container("store_login");
$container->value = NULL

thanks for help
ternes3


Originally posted by @ternes3 at zfcampus/zf-apigility#134

Unable to fetch dashboard!

We were using apigility in our project before and it was working fine, after few composer update's , apigilty admin ui was showing a blank page. After searching on github and so, we came to know that there were issues of zf-hal version, which got updated by composer update Anyways, we almost tired everything but we can not make it work, so I just removed all my packages and did a fresh, composer install , now I can see the apigilty ui but it is showing Unable to fetch dashboard!

Any help in this regard will be much appreciated.

Here is my composer.json

  "require": {
    "php": ">=5.5",
    "zendframework/zendframework": "~2.5",
    "zfcampus/zf-apigility": "~1.0",
    "doctrine/doctrine-orm-module": "~0.9.2",
    "radnan/rdn-upload": "2.*",
    "hybridauth/hybridauth": "dev-master as 2.5.1",
    "mobiledetect/mobiledetectlib": "^2.8",
    "zendframework/zendservice-twitter": "^2.1",
    "bjyoungblood/bjy-authorize": "1.4.*"

},
"require-dev": {
    "zfcampus/zf-apigility-admin": "~1.0",
    "zfcampus/zf-development-mode": "~2.0"
},

Originally posted by @HARISMEHMOOD at zfcampus/zf-apigility#177

separate module configs for different api versions

this is all related to how the underlying code of the ui reads/writes the api configs for versions to module.config.php

currently:
a src/Rest/V1/Rest and a src/Rest/V2/Rest have shared config in
module.config.php

proposed change would be something like:
src/Rest/V1/Rest with a config/module.v1.rest.config.php
src/Rest/V2/Rest with a config/module.v2.rest.config.php

this would allow for easy drop-in/removal of api versions
by just merging the extra config in Module.php::getConfig()


Originally posted by @nclundsten at zfcampus/zf-apigility#128

[Question] - How do I implement custom authentication?

Hey Guys,
Can someone please point me in the right direction for implementing custom authentication? We need Json Web Tokens for our route security.

I've been googling and pouring through the source code for days and can't seem to grasp it. Basically what I need is to create a custom authentication adapter where I can verify JWT signatures and allow or deny access to that end point based on the result. I've got all the JWT stuff handled, just need someone to point me in the right direction for creating a custom adapter.

Thanks guys!


Originally posted by @anakinjay at zfcampus/zf-apigility#163

How to implement pagination for fetch all - collection

Hi,
I am using apigility [Rest API].
I want to implement pagination for my collection services [Fetch all()].
I din't use doctorine, ORM or any mapper classes etc...
I just use cutom queries which will output data as array.

My data retrieving code from DB

use Zend\Db\Sql\Select;
use Zend\Db\Sql\Sql;

$sql = new Sql ( $this->db ); // Db adapter details
$select = $sql->select ();
$select->from ( 'user' ); // My table name

$select->columns ( array (
'userName'=> 'user_name', // Table fields
'userGuid' => user_guid // Table fields
) );

$select->where ( array (
'deleted' => 0 // where condition
) );

$stmt = $sql->prepareStatementForSqlObject ( $select ); // To prepare statement
$resultData = $stmt->execute (); // To execute statment

$result = iterator_to_array ( $resultSet );
return $result; // This will return collection data as array

How to implement pagination concept for this code?

Thank in advance!!


Originally posted by @sarathbabuSwamynathan at zfcampus/zf-apigility#190

Apigility Autoloader

Do we need still class ZF\Apigility\Autoloader? I can see it is not used in #169 and not sure what is the use case of the class? I couldn't find anything in documentation so I suggest to either:

  • add some description to the documentation, when it should be used and how it should be used
  • mark the class as @deprecated and remove in future major release

Thoughts?


Originally posted by @michalbundyra at zfcampus/zf-apigility#170

Extend Application to allow catching route exceptions - lack of Factory

According to Extend Application to allow catching route exceptions #120 there's a lack of Factory for ZF\Apigility\Application.
Adding \ZF\Apigility\Application::init($appConfig)->run(); to index.php changes nothing, because when bootstrapping application there's a call to return $serviceManager->get('Application')->bootstrap($listeners);, but $serviceManager->get('Application') returns original Zend\Mvc\Application

To be done:

  • create Factory which returns ZF\Apigility\Application
  • add it to:
'service_manager' => [
        'factories'  => [
            'Application' => \ZF\Apigility\ApplicationFactory::class,

Originally posted by @dnahrebecki at zfcampus/zf-apigility#162

Unable to create doctrine connected service

After selected adapter and entity class and clicked "Create Service", and exception thrown:

[Mon Jul 20 10:14:49 2015] PHP Catchable fatal error: Argument 1 passed to ZF\Apigility\Admin\Model\RpcServiceModelFactory::__construct() must be an instance of ZF\Apigility\Admin\Model\ModulePathSpec, instance of ZF\Configuration\ModuleUtils given, called in /home/snowwolf/PhpStormProject/ffan-service/vendor/zfcampus/zf-apigility-doctrine/src/Admin/Module.php on line 104 and defined in /home/snowwolf/PhpStormProject/ffan-service/vendor/zfcampus/zf-apigility-admin/src/Model/RpcServiceModelFactory.php on line 49


Originally posted by @snowwolf007cn at zfcampus/zf-apigility#125

This package is not a META package

Hello ;

In the readme file you describe this package as a meta package but from my point of view, this is not. A meta package should only describe dependencies allowing to install apigility in one step. Here, this package provide files (listener and so on)


Originally posted by @nuxwin at zfcampus/zf-apigility#127

development mode enable throws fatal error

Running the latest version of Apigility (1.3.2), if I disable development mode, the server just returns 500 errors for both the admin panel and any http reqeusts to the API. When trying to re-enable development mode, php throws a fatal error and the API still won't respond.

It seems like a path was hardcoded in:

$ php public/index.php development enable 
PHP Warning:  require_once(/home/matthew/sandbox/zf-apigility-skeleton-1.3.2/module/Application/Module.php): failed to open stream: No such file or directory in [...]/vendor/zendframework/zend-loader/src/ModuleAutoloader.php on line 147
PHP Fatal error:  require_once(): Failed opening required '/home/matthew/sandbox/zf-apigility-skeleton-1.3.2/module/Application/Module.php' (include_path='.:/usr/local/share/pear') in [...]/vendor/zendframework/zend-loader/src/ModuleAutoloader.php on line 147

Originally posted by @NickClaywell at zfcampus/zf-apigility#154

Link URis are mallformed when quried with "pagesize" parameter

The "_links" list of the GET method called with "page_size" parameter seems to be malformed as shown in output below. The paginator does not seem to be supporting the provided "Page Size" dynamic page size parameter properly. The URL which produced the output is;

http://localhost:8080/agri_equipment?listOnly=1

{
"_links": {
"self": {
"href": "http://localhost:8080/agri_equipment?page=1"
},
"first": {
"href": "http://localhost:8080/agri_equipment"
},
"last": {
"href": "http://localhost:8080/agri_equipment?page=3"
},
"next": {
"href": "http://localhost:8080/agri_equipment?page=2"
}
},
"_embedded": {
"agri_equipment": [
{
"equipmentId": "1",
"equipmentDesc": "Plough",
"remarks": "A manually operated Plough to be used to prepare paddy fields",
"created_on": "2017-03-11 00:00:00",
"created_by": "1",
"modified_on": "0000-00-00 00:00:00",
"modified_by": "0",
"_links": {
"self": {
"href": "http://localhost:8080/agri_equipment/1"
}
}
}
]
},
"page_count": 3,
"page_size": 1,
"total_items": 3,
"page": 1
}

If I use any of the URIs given in the "_Links" list for pagination I get the wrong data or following error due to lack of embedding the "listOnly" parameter in the URI. for ex. If I call URI for next,

http://localhost:8080/agri_equipment?page=2

I get;

{
"type": "http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html",
"title": "Conflict",
"status": 409,
"detail": "Invalid page provided"
}

However if I modify it to be as;
http://localhost:8080/agri_equipment?page=2&listOnly=1
then it works.

Hope this will help you guys to improve it.


Originally posted by @Channad at zfcampus/zf-apigility#186

The application.config.php packaged version contains absolute path to autoload config folder

After packaging the created API, the application.config.php which originally contains the key => value of :
'config_glob_paths' => [realpath(__DIR__) . '/autoload/{,*.}{global,local}.php'],
getting replaced by
'config_glob_paths' =>
array (
0 => '/tmp/ZFDeploy_57c06a6d3c68a/config/autoload/{,*.}{global,local}.php',
),

Which causes the DB connected REST services to fail with an exception

PHP Fatal error: Uncaught Zend\\ServiceManager\\Exception\\ServiceNotFoundException: ZF\\Rest\\Factory\\RestControllerFactory::canCreate requires that a valid "listener" service be specified for controller TodoBackend\\V1\\Rest\\Todo\\Controller; no service found in /home/tacsiazuma/shared/www/todobackend/vendor/zfcampus/zf-rest/src/Factory/RestControllerFactory.php:

as it's cannot resolve the DB adapters configured in local.php inside the autoload folder.


Originally posted by @letscodehu at zfcampus/zf-apigility#176

How to create action based on resource in zend apigility like — /users/[/:user_id]/customAction

I am using apigility 1.4.1 to create my rest api services.

In my case this is my routing url /users/[/:user_id]

and when i give user id with GET Http method it gives me that one particular user details.

and when i need all user details then i suppose to give /users with HTTP GET method

If it is user creation, then I will give /users and user details in request body with HTTP POST Method.

Above all are working fine for me, because apigility created routing and resource classes to receive request based on HTTP methods.

For example, If it is GET method with single entity it will route it to fetch method present in Resource class. If it is POST method with request body data then it route it to create method in Resource class.

But,

When I need to create routing url like users/[/:user_id]/reset_password

I don't know how to create it with my zend apigility rest api creator and where to receive that request and where to create my own controller to receive the request.

Can anyone please help me to do this. Thanks in advance.


Originally posted by @sarathbabuSwamynathan at zfcampus/zf-apigility#187

Apigility Admin UI issue

Hi Zend Team,

Just a concerned developer reporting some bugs. After I update my vendor via composer (sudo php composer.phar update) I went to my created services and wanted to change the Hydrator Service but the drop down selection of Hydrator Service Name in the admin is not working (it became an input field) and not showing the other options like, Zend\Stdlib|Hydrator\ObjectProperty, Zend\Stdlib|Hydrator\ClassMethods, etc. Though I find a way to manually change the hydrator service by updating the codes in the module.config.php, I just can't sit here and not report this simple bug. :)
By the way I'm currently using apigility 1.3.2

Cheers!


Originally posted by @JiNexus at zfcampus/zf-apigility#158

Fatal error: Uncaught exception 'InvalidArgumentException' with message 'Missing "type" option' in ServiceManager.php on line 946

I've just installed the latest version with composer and opened http://whatever/api/public/.
I have an error message:

Fatal error: Uncaught exception 'Zend\Mvc\Router\Exception\InvalidArgumentException' with message 'Missing "type" option' in ...\api\vendor\zendframework\zend-servicemanager\src\ServiceManager.php on line 946

PHP version 5.6.8 on Windows.
Any ideas?


Originally posted by @spidgorny at zfcampus/zf-apigility#152

Creating new clients in OAuth2 implementation

I've been playing around with Apigility, the framework does a great job. However, I've been trying to figure out how to implement OAuth2 in a mobile application.

After following the OAuth2 implementation guide, I'm now wondering how to create new clients. I have a workflow I think could work well in my mobile app:

  1. User creates a new account (system creates a new client with client_id, password, username, etc - based on OAuth2 example)
  2. User signs in
  3. System returns token
  4. Client uses the token to access the protected API

I would be using the Username and password access for Public Clients (based on the OAuth2 guide in Apigility's website).

The issue here is how to create a new user in the OAuth2 client table, I was expecting a POST request to mydomain.com/oauth/clients but of course that doesn't work.

Whats the right workflow to achieve this in Apigility?


Originally posted by @manuelro at zfcampus/zf-apigility#159

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.