Magento Module Script – Additional setup – Part 03

Finally we’re in the end of Magento Module scripts article series. In specific we’ve divided the series in two section where each section has three articles. Simple before signing out here we’d like to discuss some additional Magento script which is very useful in different circumstance.

If you’re  new to Magento and want to get rid of such technical jobs. Or in case you want focus more on sale rather than messing with development. Simply buy our Magento SSD cloud hosting plan and enjoy full web development support for beautiful and fast loading eCommerce website. Also enjoy different offers round the year and 28% off in first month invoice. However our Mage plans begin as low as USD 9.99 per month including a lot of premium features.

Tanzia Farin Chy  for Aspiration Hosting

Magento Script – Additional setup

However EAV attributes are generally included through the setup. And for doing the same we use the following path : \Magento\Eav\Setup\EavSetup. Basically we inject the same in InstallData.
Here Magento Script for additional setup is following:

namespace Aspiration\Custom\Setup;
//use any custom name instead of aspiration
use Magento\Eav\Setup\EavSetupFactory;
use Magento\Framework\Setup\InstallDataInterface;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\ModuleDataSetupInterface;
class InstallData implements InstallDataInterface
* EAV setup factory
* @var EavSetupFactory
private $eavSetupFactory;
* Init
* @param EavSetupFactory $eavSetupFactory
public function __construct(EavSetupFactory $eavSetupFactory)
$this->eavSetupFactory = $eavSetupFactory;
* {@inheritdoc}
public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
/** @var \Magento\Eav\Setup\EavSetup $eavSetup */
$eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
'type' => 'varchar',
'input' => 'text',
'label' => 'Aspiration Custom',
'required' => false,
'user_defined' => true,
'global' => \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_STORE,
'group' => 'Aspiration Custom',

So far for further reference, the best way is to check Customer InstallData and Catalog.
Though in some case you might need some hand while dealing with Mage Module scripts.

By the way, you can hire a developer for detail custom based report and even a technical audit. But you can also choose our hosting plans and enjoy full free development support on your website with us.

Regardless of anything enjoy learning and so on Mage 2!!!!

Now reading Part 03 | Part 01 | Part 02