GithubHelp home page GithubHelp logo

dimitribouteille / wp-module-rest-api Goto Github PK

View Code? Open in Web Editor NEW
10.0 1.0 0.0 63 KB

πŸš€ Quickly add routes to the WordPress REST API.

Home Page: https://packagist.org/packages/dbout/wp-module-rest-api

License: MIT License

PHP 100.00%
api rest rest-api wordpress php wordpress-rest-api wp wordpress-starter wordpress-development wordpress-api

wp-module-rest-api's Introduction

Bonjour πŸ‘‹

Linkedin Badge Instagram Badge Spotify Badge

I'm a French developer whose main objective is to share code to improve the WordPress ecosystem β™₯️ and propose fix on Magento 2 modules.

I am currently working on Magento 2 and React projects at Reflet & Co. in Lyon - France.

Main projects :

Skills:

Magento, React, Next.js, scss, Wordpress, C#, ...

Hobbies :

Fencing, running, architecture, photography, ...

wp-module-rest-api's People

Contributors

dimitribouteille avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

wp-module-rest-api's Issues

Dbout\WpRestApi\Loaders\AnnotationDirectoryLoader::findClass() not working with named arguments

<?php

use Dbout\WpRestApi\Attributes\Route;
use Dbout\WpRestApi\Attributes\Action;

#[Route(
    namespace: 'app/v2',
    route: 'document/(?P<documentId>\d+)'
)]
class Document 
{

    #[Action(Method::GET)]
    public function get(\WP_REST_Request $request): \WP_REST_Response
    {
        // Add your logic 
        $id = $request->get_param('documentId');
       
        return new \WP_REST_Response([
            'success' => true,
        ]);
    }

   #[Action(Method::DELETE)]
    public function delete(\WP_REST_Request $request): \WP_REST_Response
    {
        // Add your logic 
        $id = $request->get_param('documentId');
        
        return new \WP_REST_Response([
            'success' => true,
        ]);
    }
}

findClass not working with this file ... route/Document returned :(

[BUG] Parser::findClassName return invalid className

With this class :

<?php

namespace Dbout\DendreoWebhook\Api\Routes\Webhook;

use Dbout\DendreoWebhook\Entities\DendreoEvent;
use Dbout\DendreoWebhook\Api\Exceptions\DendreoWebhookException;
use Dbout\DendreoWebhook\Logger\Logger;
use Dbout\DendreoWebhook\Enums\Webhook;
use Dbout\DendreoWebhook\Services\Builders\BuilderInterface;
use Dbout\WpRestApi\Attributes\Action;
use Dbout\WpRestApi\Attributes\Route;
use Dbout\WpRestApi\Enums\Method;
use Dbout\WpRestApi\Exceptions\RouteException;

#[Route(
    'app/v2',
    'dendreo/webhook'
)]
class Create
{
    /**
     * @param \WP_REST_Request $request
     * @return \WP_REST_Response
     * @throws DendreoWebhookException
     * @throws RouteException
     */
    #[Action(methods: Method::POST)]
    public function execute(\WP_REST_Request $request): \WP_REST_Response
    {
        throw new \Exception('Invalid builder class type.');
}

return Dbout\DendreoWebhook\Api\Routes\Webhook\type ...

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.