thank you all i got it
i followed as per the post
How can I bootstrap Magento 2 in a test.php script?
in root folder i created script/abstract.php
<?php
use \Magento\Framework\AppInterface as AppInterface;
use \Magento\Framework\App\Http as Http;
use Magento\Framework\ObjectManager\ConfigLoaderInterface;
use Magento\Framework\App\Request\Http as RequestHttp;
use Magento\Framework\App\Response\Http as ResponseHttp;
use Magento\Framework\Event;
use Magento\Framework\Filesystem;
use Magento\Framework\App\AreaList as AreaList;
use Magento\Framework\App\State as State;
abstract class AbstractApp implements AppInterface
{
public function __construct(
\Magento\Framework\ObjectManagerInterface $objectManager,
Event\Manager $eventManager,
AreaList $areaList,
RequestHttp $request,
ResponseHttp $response,
ConfigLoaderInterface $configLoader,
State $state,
Filesystem $filesystem,
\Magento\Framework\Registry $registry
) {
$this->_objectManager = $objectManager;
$this->_eventManager = $eventManager;
$this->_areaList = $areaList;
$this->_request = $request;
$this->_response = $response;
$this->_configLoader = $configLoader;
$this->_state = $state;
$this->_filesystem = $filesystem;
$this->registry = $registry;
}
public function launch()
{
$this->run();
return $this->_response;
}
abstract public function run();
public function catchException(\Magento\Framework\App\Bootstrap $bootstrap, \Exception $exception)
{
return false;
}
}
and then script/index.php
<?php
require dirname(__FILE__) . '/../app/bootstrap.php';
$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $_SERVER);
require dirname(__FILE__) . '/abstract.php';
class Getapp extends AbstractApp
{
public function run()
{
$this->_objectManager->get('Magento\Framework\Registry')
->register('isSecureArea', true);
$datas = $this->_objectManager->create('\Magento\Sales\Model\ResourceModel\Order\Collection');
// $products = $this->_objectManager->create('\Sugarcode\Test\Model\Test'); // custom Module
//$products = $this->_objectManager->create('\Magento\Catalog\Model\Product');
// $products = $products->getCollection();
foreach($datas as $data){
echo $data->getIncrementId().'<br>';
}
}
}
/** @var \Magento\Framework\App\Http $app */
$app = $bootstrap->createApplication('Getapp');
$bootstrap->run($app);
so in index.php write your logic and url/script/index.php
it working fine