File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -559,6 +559,24 @@ $queryDepth->setMaxQueryDepth($maxQueryDepth = 10);
559559GraphQL::execute(/*...*/);
560560``` 
561561
562+ #### Disabling Introspection  
563+ 
564+ This is a PHP port of [ graphql-disable-introspection] ( https://github.com/helfer/graphql-disable-introspection ) .
565+ The rule prohibits queries that contain ` __type `  or ` __schema `  fields.
566+ 
567+ This document validator rule is disabled by default. Here an example to enable it:
568+ 
569+ ``` php 
570+ use GraphQL\GraphQL;
571+ use GraphQL\Validator\Rules\DisableIntrospection;
572+ 
573+ /** @var \GraphQL\Validator\Rules\DisableIntrospection $disableIntrospection */
574+ $disableIntrospection = DocumentValidator::getRule('DisableIntrospection');
575+ $disableIntrospection->setEnabled(DisableIntrospection::ENABLED);
576+ 
577+ GraphQL::execute(/*...*/);
578+ ``` 
579+ 
562580### More Examples  
563581Make sure to check [ tests] ( https://github.com/webonyx/graphql-php/tree/master/tests )  for more usage examples.
564582
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments