Change the version number depends on your PHP version
1 2 3 4 5 vi /usr/local /etc/php/7.4/php.ini memory_limit = -1 php -i |grep -i memory_limit
Get graphql schema through curl 1 2 3 4 5 curl 'https://gitlab.com/api/graphql' \ -H 'Content-Type: application/json' \ -H 'Accept: application/json' \ --data-binary '{"query":"# Write your query or mutation here\nquery {\n __schema {\n mutationType {\n fields {\n name\n }\n }\n queryType {\n fields {\n name\n }\n }\n\t\ttypes{\n name\n }\n directives{\n name\n }\n }\n}"}' \ | jq
GraphQL query 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 query { __schema { mutationType { fields { name } } queryType { fields { name } } types{ name } directives{ name } } }
Online Live GitLab link https://gitlab.com/-/graphql-explorer
Ngrok secure introspectable tunnels to localhost
1 2 3 brew cask install ngrok ngrok http 8080
Servo Expose local 5000 port to the internet
1 ssh -R 80:localhost:5000 serveo.net
Real World - Web Scraper Web scraper in diffence language
Requirement of deployment server (production server) 1 apt-get install -y git php
Deployer 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 curl -LO https://deployer.org/deployer.phar chmod +x deployer.phar composer global require deployer/deployer composer require deployer/dist --dev php vendor/bin/dep ./deployer.phar self-update ./deployer.phar self-update --upgrade ./deployer.phar init ./deployer.phar deploy server-production ./deployer.phar run 'ifconfig'
Sample of deployer.php 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 <?php namespace Deployer ;require 'recipe/common.php' ;set('repository' , 'https://github.com/calvinlam0124/cron-mysqldump.git' ); set('deploy_path' , '~/deployer/' . basename(get('repository' ), '.git' )); set('default_stage' , 'server-test' ); host('localhost' ) ->user('root' ) ->port(22000 ) ->stage('server-test' ) ->forwardAgent(); host('server2.localhost' ) ->user('root' ) ->port(22000 ) ->stage('server-production' ) ->forwardAgent(); desc('Deploy your project' ); task('deploy' , [ 'deploy:info' , 'deploy:prepare' , 'deploy:lock' , 'deploy:release' , 'deploy:update_code' , 'deploy:shared' , 'deploy:writable' , 'deploy:clear_paths' , 'deploy:symlink' , 'deploy:unlock' , 'cleanup' , 'success' ]); after('deploy:failed' , 'deploy:unlock' );
reference https://deployer.org/docs/examples/inventory.html
Source code touch “src/HelloWorld.php”
1 2 3 4 5 6 7 <?php namespace CalvinLam ;class HelloWorld { public function say () { echo "Hello world!" ; } }
touch “composer.json”
1 2 3 4 5 6 7 8 9 10 11 12 13 14 { "license" : "proprietary" , "name" : "calvinlam/hello-world" , "description" : "calvinlam's test composer package" , "minimum-stability" : "dev" , "require" : { }, "autoload" : { "psr-4" : { "CalvinLam\\" : "src/" } } }
Develop your package locally
1 2 3 4 <?php require ("vendor/autoload.php" );\CalvinLam\HelloWorld::say(); echo "done" ;
Download your private package
config your private repo OAuth access
touch composer.json1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 { "repositories" : [ { "url" : "https://bitbucket.org/calvin-lam/php-composer-module-hello-world.git" , "type" : "git" } ], "require" : { "calvinlam/hello-world" : "dev-master" }, "config" : { "bitbucket-oauth" : { "consumer-key" : "xxxxx" , "consumer-secret" : "yyyyyy" } } }