Tag: php
-
Curl API call in PHP
1 I’m new to PHP and trying to make a request to a third-party API using curl. This is what I am trying, but it is just responding with what is on the API’s root endpoint. $service_url = ‘https://api.kivaws.org/graphql’; $curl = curl_init($service_url); $curl_post_data = array( ‘Pragma’ => ‘no-cache’, ‘Origin’ => ‘https://api.kivaws.org’, ‘Accept-Encoding’ => ‘gzip, deflate’,…
-
Graphql library helper to connect to external endpoint
0 For a project I have to do some requests in PHP to a GraphQL endpoint. I’m familiar with Graphql to build query’s. The most of the project is build in node.js, where I use axios to handle the requests. But in PHP I couldn’t figure it out, it seems I’m having problems setting up…
-
Installing vendor library using composer
0 I’m trying to use the https://github.com/webonyx/graphql-php/ library to make graphql requests.. But for some reason it doesn’t work, and I can’t figure out why. I’m using this command to install: composer require webonyx/graphql-php Vendor folder with content + composer.json / composer.lock appears in the project folder. When I try a simple code like: <?php…
-
Return custom collection in graphQL with Api Platform using custom data provider
0 I have a custom DTO class, and I want to return a collection of that using graphQL. With REST it works fine. I’m using Api Platform 2.6 and PHP 8.2 There is my DTO class : <?php declare(strict_types=1); namespace AppDto; use ApiPlatformCoreAnnotationApiProperty; use ApiPlatformCoreAnnotationApiResource; #[ApiResource( collectionOperations: [ ‘get’ => [ ‘method’ => ‘GET’, ‘path’…
-
“Extract” mutation name from an “OperationDefinitionNode” Object?
1 I am using the webonyx/graphql-php and Laravel. I have a single middleware that "catches" all graphql requests and I would like to apply some logic to filter some requests depending if the request is a mutation and which mutation it is. I "intersect" the graphql query (similar to this one) where the mutation storeCC…
-
Totara GraphQL API Add New Query
0 I’m trying to add a new query to the Totara External GraphQL API available on Totara v17. Following the docs I’ve created the following structure: local/plugin/webapi/external/get_completions.graphql query local_plugin_get_completions{ local_plugin_get_completions{ id } } local/plugin/webapi/external/schema.graphqls extend type Query { local_plugin_get_completions: [local_plugin_get_completions!]! } type local_plugin_get_completions{ id: core_id, } local/plugin/classes/webapi/resolver/query class get_completions extends corewebapiquery_resolver { public static function…
-
Laravel Rebing GraphQL – Pagination on sub relation
0 I’m trying to paginate the relations through a parent pivot. A user has topics and a topic can have multiple users. Multiple users can be the owner of a topic. A topic has messages. class Topic extends Model { //Casts Fillables etc. public function user(): BelongsToMany { return $this->belongsToMany(User::class, ‘topic_users’, ‘topic_uuid’, ‘user_uuid’) ->withPivot([ ‘uuid’,…
-
Laravel graphql lighthouse not working properly
0 I am using GraphQL Lighthouse for Laravel 10 project for the first time and I stuck in first phase of api. I exactly do what documentation said Link Here and YouTube tutorial Install lighthouse package composer require nuwave/lighthouse Publish the default schema php artisan vendor:publish –tag=lighthouse-schema IDE Support php artisan lighthouse:ide-helper Install GraphQL DevTools…
-
How do you create a template with replaceable variables for JS/React?
0 Context: I want to create a GraphQL query template with different variables that I can replace with key/values from another dictionary I want to give JS/React this template and dictionary and be able to replace the variables in the template with the corresponding values in the dictionary How would you recommend I do this?…
-
How can I getting only the number id of the product in shopify using graphql and laravel app
0 This is my routes Route::get(‘/carts/{numericProductID}’, ‘AppHttpControllersShopifyController@showProductDetails’) ->name(‘showProductDetails’); This is the link to direct to other page to show/fetch the details of the selected product <a href="{{ route(‘showProductDetails’, [‘numericProductID’ => $product[‘node’][‘id’]]) }}">View Details</a> php html laravel graphql shopify Share Follow asked 33 mins ago Ruel A AlmoniaRuel A Almonia 111 bronze badge 1 What is…