PHP code example of thecodingmachine / graphqlite

1. Go to this page and download the library: Download thecodingmachine/graphqlite library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

thecodingmachine / graphqlite example snippets


class ProductController
{
    #[Mutation]
    public function updateProduct(Product $product): Product
    {
        // Some code that gets and updates a Product
        return $product;
    }
}

#[Type]
#[Input(update: true)]
class Product
{
    #[Field]
    public function getName(): string
    {
        return $this->name;
    }
    
    #[Field]
    public function setName(string $name): void
    {
        $this->name = $name;
    }
    
    // ...
}